Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
How to print new line in Java?
The java.io.PrintStream.println() method prints an array of characters and then terminate the line. This method behaves as though it invokes print(char[]) and then println().
Using this method you can print the data on the console.
import java.io.*;
public class PrintStreamDemo {
public static void main(String[] args) {
char[] c = {'a', 'b', 'c'};
// create print stream object
PrintStream ps = new PrintStream(System.out);
// print an array and change line
ps.println(c);
ps.print("New Line");
// flush the stream
ps.flush();
}
}
Output
abc New Line
Advertisements
