Java PrintStream.print(float f)
Syntax
PrintStream.print(float f) has the following syntax.
public void print(float f)
Example
In the following code shows how to use PrintStream.print(float f) method.
/*w w w . java2 s . c o m*/
import java.io.*;
public class Main {
public static void main(String[] args) {
float x = 1.23f;
PrintStream ps = new PrintStream(System.out);
// print float
ps.print(x);
// flush the stream
ps.flush();
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »