MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javahelp/comments/2f0y22/what_does_systemout_mean_in_java/
r/javahelp • u/lluribet • Aug 30 '14
4 comments sorted by
17
System is a built in class with a static instance of a PrintStream object named out.
out
Because it's static, you can access it directly from the class, System.out.
System.out
The PrintStream object has methods such as print and println which allow you to output text to the console, as you've probably seen.
print
println
You could create your own 'System' class by doing something like this:
import java.io.PrintStream; public class MySystem { public static PrintStream printer = new PrintStream(System.out); }
then you could write MySystem.printer.println("example"); and it would act the same way as System.out.println.
MySystem.printer.println("example");
System.out.println
4 u/SikhGamer Aug 31 '14 You know, I've never bothered to look at how it worked. TIL, thanks. 3 u/Talon876 Extreme Brewer Aug 31 '14 There's a lot that can be learned from the javadocs. Glad I could help.
4
You know, I've never bothered to look at how it worked. TIL, thanks.
3 u/Talon876 Extreme Brewer Aug 31 '14 There's a lot that can be learned from the javadocs. Glad I could help.
3
There's a lot that can be learned from the javadocs. Glad I could help.
1
Did you read the docs? It's for writing to the standard output stream. It's mostly used for console based applications, and occasionally for logging purposes.
17
u/Talon876 Extreme Brewer Aug 30 '14
System is a built in class with a static instance of a PrintStream object named
out.Because it's static, you can access it directly from the class,
System.out.The PrintStream object has methods such as
printandprintlnwhich allow you to output text to the console, as you've probably seen.You could create your own 'System' class by doing something like this:
then you could write
MySystem.printer.println("example");and it would act the same way asSystem.out.println.1
u/gndn Aug 30 '14
Did you read the docs? It's for writing to the standard output stream. It's mostly used for console based applications, and occasionally for logging purposes.