File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes System.out.print Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "System.out.print" Watch "System.out.print" New topic


Sunesh Kumar
Ranch Hand

Joined: Oct 17, 2005
Posts: 89
Hi to all,

Can i know in "System.out.println" which one executes first
whether println or out class
please help me

thanks in advance

Thanks & Regards<br />Sunesh Kumar Baachu
Abdulla Mamuwala
Ranch Hand

Joined: Jan 09, 2004
Posts: 225
Can i know in "System.out.println" which one executes first
whether println or out class

In System.out.println , out is not a class it is a field of the System class, check API. The field out is of type PrintStream, println is a method of the PrintStream class, you can check the API for the PrintStream class.It is always good t refer to the API if you have such doubts in the future.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Println is a method on an object, and out is a reference to that object. So the method executes on whatever object "out" points to ... some kind of PrintStream. Does that make sense?

Just because repetition sometimes helps, let's go the other way and take this apart into little pieces:

System is a class
out is a static variable on the class
out is a reference to an object instance
that object has a type of PrintStream
PrintStream has the method println

Lots of little bits there!

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: System.out.print
It's not a secret anymore!