PrintStream Print8() Example

Prints an object.


PrintStreamclass Print8() method example. This example shows you how to use Print8() method.This method Prints an object.

Here is the code:-


/**
 * @Program that Prints an object.
 * Print8.java 
 * Author:-RoseIndia Team
 * Date:-10-Jun-2008
 */
import java.io.*;

public class Print8 {

    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);
        //Prints an object.
        ps.print(new String("Tewari") );
        System.out.print("Object is : ");
        for(int i=0;i<d.length();i++)
        System.out.print((charfin.read());
                   }
}

Output of the Program
 Object is : Tewari

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

HOME | COPYRIGHT | CONTACT US