PrintStream Print2() Example

Prints a character.


PrintStreamclass Print2() method example. This example shows you how to use Print2() method.This method Prints a character.

Here is the code:-

/**
 * @Program that Prints a character.
 * Print2.java 
 * Author:-RoseIndia Team
 * Date:-10-Jun-2008
 */
import java.io.*;

public class Print2 {

    public static void main(String[] argsthrows IOException {
        char c = 'G';
        //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 a character.
        ps.print(c);
        System.out.print("character is: "+(char)fin.read());
        
       
          }
}

Output of the Program
 character is: G

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

HOME | COPYRIGHT | CONTACT US