Difference Between System.out.print() and System.out.println() Function in Java Last Updated : 07 Oct, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report In Java, we have the following functions to print anything in the console. System.out.print() andSystem.out.println() But there is a slight difference between both of them, i.e. System.out.println() prints the content and switch to the next line after execution of the statement whereas System.out.print() only prints the content without switching to the next line after executing this statement. The following examples will help you in understanding the difference between them more prominently. Example 1: Java import java.io.*; class GFG { public static void main(String[] args) { System.out.println("Welcome to JAVA (1st line)"); // this print statement will be printed in a new line. System.out.print("Welcome to GeeksforGeeks (2nd line) "); // this print statement will be printed in the same line. System.out.print("Hello Geeks (2nd line)"); } } OutputWelcome to JAVA (1st line) Welcome to GeeksforGeeks (2nd line) Hello Geeks (2nd line) Example 2: Java import java.io.*; class GFG { public static void main(String[] args) { System.out.print("Welcome to JAVA (1st line) "); // this print statement will be printed in the same line. System.out.println("Welcome to GeeksforGeeks (1st line)"); // this print statement will be printed in a new line. System.out.print("Hello Geeks (2nd line)"); } } OutputWelcome to JAVA (1st line) Welcome to GeeksforGeeks (1st line) Hello Geeks (2nd line) Comment More infoAdvertise with us Next Article Difference Between System.out.print() and System.out.println() Function in Java N nitind356 Follow Improve Article Tags : Java Difference Between Practice Tags : Java Similar Reads Difference Between System.out.println() and System.err.println() in Java System.out is a PrintStream to which we can write characters. Â It outputs the data we write to it on the Command Line Interface console/terminal. It is mostly used for console applications/programs to display the result to the user. It can be also useful in debugging small programs. Syntax: System.o 2 min read Redirecting System.out.println() Output to a File in Java System.out.println()Â is used mostly to print messages to the console. However very few of us are actually aware of its working mechanism. We can use System.out.println() to print messages to other sources too, not just restricting it to the console. However, before doing so, we must reassign the st 2 min read Difference Between Void and Non Void Methods in Java The method in Java or Methods of Java is a collection of statements that perform some specific task and return the result to the caller. Every method has a return type that can be differentiated between void and non-void. In this article, we will learn about void and non-void methods. Void Methods i 2 min read PrintStream print(double) method in Java with Examples The print(double) method of PrintStream Class in Java is used to print the specified double value on the stream. This double value is taken as a parameter. Syntax: public void print(double doubleValue) Parameters: This method accepts a mandatory parameter doubleValue which is the double value to be 2 min read PrintStream println(int) method in Java with Examples The println(int) method of PrintStream Class in Java is used to print the specified int value on the stream and then break the line. This int value is taken as a parameter. Syntax: public void println(int intValue) Parameters: This method accepts a mandatory parameter intValue which is the int value 2 min read Like