• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

About System.out.println() method

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ....
 
Ranch Hand
Posts: 2066
IntelliJ IDE Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 446
1
Eclipse IDE MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can call out.println() by making a Static Import.

its like:


C Ya
 
Straws are for suckers. Now suck on this tiny ad!
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic