aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes System.err and System.out Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "System.err and System.out" Watch "System.err and System.out" New topic
Author

System.err and System.out

Prahalad Deshpande
Greenhorn

Joined: Oct 31, 2006
Posts: 14
Hi Ranchers,
Just wanted to get this straightened for me. Are System.err and System.out OBJECTS or are they PROPERTIES of the System class?

Thanks a lot in advance

Regards
Prahalad
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2341
out and err are static class variables in the System class that refer to PrintStream objects.
venkatesh pendharkar
Ranch Hand

Joined: Apr 29, 2006
Posts: 104
System class contains 3 static class variables:
public static final PrintStream out;
public static final PrintStream err;
public static final InputStream in

Because out is a reference variable of PrintStream class;the value returned by System.out must either be null or an object of class PrintStream.
When JVM starts an application running,it instantiates an object of PrintStream class & connects it to standard output device(Command prompt)
When PrintStream object is instantited by JVM,its reference variable is assigned to the "out" class variable of the System class.
Thus System.out returns an object of class PrintStream & in class PrintStream there is a method called println() which prints the string on screen.
So by System.out.println() ; we are able to print characters on screen.

I dont know much about err variable & whats its use.Can anyone tell?
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: System.err and System.out
 
Similar Threads
System.out ?
how to get Date ?
Unable to redirect all the eclipse console logs to buffer
Problem in eclipse IDE Galileo
What is the different b/w System.out & System.err & System.in