PrintStream Print3() Example

Prints an array of characters.


PrintStreamclass Print3() method example. This example shows you how to use Print3() method.This method Prints an array of characters.

Here is the code:-

/**
 * @Program that Prints an array of characters.
 * Print3.java 
 * Author:-RoseIndia Team
 * Date:-10-Jun-2008
 */
import java.io.*;

public class Print3 {

    public static void main(String[] argsthrows IOException {
        char c[] {'G','i','r','i','s','h'};
        //Creating FileOutputStream object
        FileOutputStream out = new FileOutputStream("/home/girish/Desktop/g/m.txt");
        FileInputStream fin = new FileInputStream("/home/girish/Desktop/g/m.txt");
        //Creating PrintStream object
        PrintStream ps = new PrintStream(out);
        //Prints an array of characters.
        ps.print(c);
         System.out.print("character array is: ");
         for(int i=0;i<c.length;i++)
        System.out.print((char)fin.read());
        
       
          }
}

Output of the Program
 character array is: Girish

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

HOME | COPYRIGHT | CONTACT US