• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

what is out in System.out.println()

 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
tell me how this is done ? by using class name you can call its static method then what is that 'out'
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why are you posting 3 threads with the same question .. ?
https://coderanch.com/t/278232/Streams/java/Creating-InputStream-String
https://coderanch.com/t/278233/Streams/java/Reading-files-size-MB


Anyway, the out is just a static reference variable containing a PrintStream.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've deleted the extra copies. Really, Ravindra, you only need to press the "Add New Topic" button once. As for the question... have you taken a look at the API? Specifically, for the System class? Useful stuff.
 
ravindra patil
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by ravindra patil:
tell me how this is done ? by using class name you can call its static method then what is that 'out'



i pressed it only once but when i went out for some time my session was espired so browes showed me 'session expired' press retry or cancle so each time i pressed retry my topic got added thats why yow saw same topic 3 times sorry for that.... :roll:
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic