Menu
Topics Index
...
`

PrintStreamDemo - Java Example Program


PrintStreamDemo
import java.io.*;

class PrintStreamDemo
{
    public static void main(String arg[])
    {
        String s = "Alone we can do so little";//LINE A
        
        PrintStream ps = new PrintStream(System.out); //LINE B
        
        ps.format(" %s, Together we can do so much ", s);// LINE C
        
        ps.close();// LINE D
    
    }
}
OUTPUT

Alone we can do so little, Together we can do so much

DESCRIPTION

At LINE A we created a String. At LINE B we created PrintStream object. At LINE C we formated String. At LINE D we closed PrintStream.

© meritcampus 2019

All Rights Reserved.

Open In App