PrintWriter print(Object) method in Java with Examples Last Updated : 31 Jan, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The print(Object) method of PrintWriter Class in Java is used to print the specified Object on the stream. This Object is taken as a parameter. Syntax: public void print(Object object) Parameters: This method accepts a mandatory parameter object which is the Object to be printed in the Stream. Return Value: This method do not returns any value. Below methods illustrates the working of print(Object) method: Program 1: Java // Java program to demonstrate // PrintWriter print(Object) method import java.io.*; class GFG { public static void main(String[] args) { try { // Create a PrintWriter instance PrintWriter writer = new PrintWriter(System.out); // Get the char[] object // to be printed in the stream char[] object = { 'G', 'e', 'e', 'k', 's', 'F', 'o', 'r', 'G', 'e', 'e', 'k', 's' }; // print the object // to this writer using print() method // This will put the object in the stream // till it is printed on the console writer.print(object); writer.flush(); } catch (Exception e) { System.out.println(e); } } } Output: GeeksForGeeks Program 2: Java // Java program to demonstrate // PrintWriter print(Object) method import java.io.*; class GFG { public static void main(String[] args) { try { // Create a PrintWriter instance PrintWriter writer = new PrintWriter(System.out); // Get the String Object // to be printed in the stream String object = "GFG"; // print the object // to this writer using print() method // This will put the object in the stream // till it is printed on the console writer.print(object); writer.flush(); } catch (Exception e) { System.out.println(e); } } } Output: GFG Comment More infoAdvertise with us Next Article PrintWriter print(Object) method in Java with Examples K Kirti_Mangal Follow Improve Article Tags : Java Java-Functions Java-IO package Java-PrintWriter Practice Tags : Java Similar Reads PrintWriter println(Object) method in Java with Examples The println(Object) method of PrintWriter Class in Java is used to print the specified Object on the stream and then break the line. This Object is taken as a parameter. Syntax: public void println(Object object) Parameters: This method accepts a mandatory parameter object which is the Object to be 2 min read PrintWriter printf(String, Object) method in Java with Examples The printf(String, Object) method of PrintWriter Class in Java is used to print a formatted string in the stream. The string is formatted using specified format and arguments passed as the parameter. Syntax: public PrintWriter printf(String format, Object...args) Parameters: This method accepts two 2 min read PrintStream print(Object) method in Java with Examples The print(Object) method of PrintStream Class in Java is used to print the specified Object on the stream. This Object is taken as a parameter. Syntax: public void print(Object object) Parameters: This method accepts a mandatory parameter object which is the Object to be printed in the Stream. Retur 2 min read PrintStream println(Object) method in Java with Examples The println(Object) method of PrintStream Class in Java is used to print the specified Object on the stream and then break the line. This Object is taken as a parameter. Syntax: public void println(Object object) Parameters: This method accepts a mandatory parameter object which is the Object to be 2 min read PrintWriter println() method in Java with Examples The println() method of PrintWriter Class in Java is used to break the line in the stream. This method do not accepts any parameter or return any value. Syntax: public void println() Parameters: This method do not accepts any parameter. Return : This method do not returns any value. Below methods il 2 min read Like