PrintStream Println() Example

Terminates the current line by writing the line separator string.


PrintStreamclass Println() method example. This example shows you how to use Println() method.This method Terminates the current line by writing the line separator string.

Here is the code:-


/**
 * @Program that Terminates the current line by writing the line separator string.
 * Println.java 
 * Author:-RoseIndia Team
 * Date:-10-Jun-2008
 */
import java.io.*;

public class Println {

    public static void main(String[] argsthrows IOException {
        String d = "Girish";
        //Creating FileOutputStream object
        FileOutputStream out = new FileOutputStream("text.txt");
        FileInputStream fin = new FileInputStream("text.txt");
        //Creating PrintStream object
        PrintStream ps = new PrintStream(out);
        //Terminates the current line by writing the line separator string.
        ps.println(d);
        System.out.print("String is : ");
        for(int i=0;i<d.length();i++)
        System.out.print((charfin.read());
                   }
}

Output of the Program
 String is : Girish

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US