Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About System.out.println() method

 
Venu Babu Ravi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

1)Can any one expline about System.out.println() method ?
2)How we can call System.out ?
3)How we can call out.println()?

Thanks in Advance ....
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
System is a Class in Java API. out is a static field in that System class, So you called with 'System.out' as usual.

Have look at this API

println() is a method of the class PrintStream, since the System class has the the static instance(out) of this class(PrintStream), we invoked println() method on top of that instance

Have look at here
 
Prasad Kharkar
Ranch Hand
Posts: 446
1
Eclipse IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
System is a class in java
out is the static field of System class that gives us the PrintStream for output
println() method prints whatever text is provided in it and goes to the next line
it is fully defined as


as it is static field we call it using the class name i.e. System.out

Now printlln() is the method defined in the PrintStream class and we are calling the println() method using PrintStream object got using System.out

hence in short
System.out.println()
means that print a line of text and go the next line on the output stream of the System.



about your third question
you have to read a little about static imports
you can find it herehere
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Venu Babu Ravi wrote:1)Can any one expline about System.out.println() method ?

from source file of PrintStream in Java API., so it just give you the new line/emptyline.


Venu Babu Ravi wrote:2)How we can call System.out ?

Generally, System.out called as variable which point to the PrintStream object

Venu Babu Ravi wrote:3)How we can call out.println()?

using the PrintStream object's reference you are calling the method of println.

hth
 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can call out.println() by making a Static Import.

its like:


C Ya
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic