+ 2

'System' is a class and 'out' is stream. What is a stream and what it do?

19th Nov 2016, 4:39 AM
Avinash Choudhary
Avinash Choudhary - avatar
2 Answers
+ 3
System is a class in the java.lang package.  out is a static member of the System class, and is an instance of java.io.PrintStream . The PrintStream class provides methods to write data to another stream. The PrintStream class automatically flushes the data so there is no need to call flush() method. println is a method of java.io.PrintStream . This method is overloaded to print message to output destination, which is typically a console or file. For more information you can go through below link. http://stackoverflow.com/questions/3406703/whats-the-meaning-of-system-out-println-in-java
19th Nov 2016, 11:31 AM
Ankit Sanghavi
Ankit Sanghavi - avatar
0
Think of a stream like a conveyor belt at a supermarket. You place objects on one end of the conveyor belt, and it moves to the other side, where the cashier picks it up. A stream works a little like that. For System.out, you put a request to print a String, int, etc. on the conveyor belt, and it travels to where it's processed by the computer and printed onscreen.
21st Nov 2016, 9:07 PM
DaemonThread
DaemonThread - avatar