PrintStream Println8() Example
Prints an Object and then terminate the line.
PrintStreamclass Println8() method example. This example shows you how to use Println8() method.This method Prints an Object and then terminate the line.
Here is the code:-
/**
* @Program that Prints an Object and then terminate the line.
* Println8.java
* Author:-RoseIndia Team
* Date:-10-Jun-2008
*/
import java.io.*;
public class Println8 {
public static void main(String[] args) throws IOException {
String d = "Tewari";
//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 and then terminate the line.
ps.println(new String("Girish"));
System.out.print("Object is : ");
for (int i = 0; i < d.length(); i++) {
System.out.print((char) fin.read());
}
}
} |
|