• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

System.out.print

 
Sunesh Kumar
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Abdulla Mamuwala
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bachu,
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
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic