PrintStream Println5() Example
Prints a float and then terminate the line.
PrintStreamclass Println5() method example. This example shows you how to use Println5() method.This method Prints a float and then terminate the line.
Here is the code:-
/**
* @Program that Prints a float and then terminate the line.
* Println5.java
* Author:-RoseIndia Team
* Date:-10-Jun-2008
*/
import java.io.*;
public class Println5 {
public static void main(String[] args) throws IOException {
float d = 23.4f;
//Creating FileOutputStream object
FileOutputStream out = new FileOutputStream("text.txt");
FileInputStream fin = new FileInputStream("text.txt");
//Creating PrintStream object
PrintStream ps = new PrintStream(out);
//Prints a float and then terminate the line.
ps.println(d);
System.out.print("Float is : ");
System.out.print((char) fin.read());
System.out.print((char) fin.read());
System.out.print((char) fin.read());
System.out.print((char) fin.read());
}
} |
|