PrintStream.print(Object obj) has the following syntax.
public void print(Object obj)
In the following code shows how to use PrintStream.print(Object obj) method.
//from www.j a v a2s .c om import java.io.*; public class Main { public static void main(String[] args) { Object x = 50; Object s = "from java2s.com"; PrintStream ps = new PrintStream(System.out); // print objects ps.print(x); ps.print(s); // flush the stream ps.flush(); } }
The code above generates the following result.