Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how is System.in an object?  RSS feed

 
seemalk
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone tell me how System.in is deemed an object when InputStream is an abstract class. I had asked this once before.Kindly help
Thanks a lot in advance
seema
 
Brent Worden
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The concrete class of System.in is hidden from users. Rest assured though, the actual class of System.in is a subclass of InputStream. If you want to get the actual class name of System.in, put this line in your code somewhere:

------------------
Brent Worden
http://www.Brent.Worden.org/
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Java Ranch has a naming policy, described here and "seemalk" is not a valid name. Please choose one which meets the requirements.
Thanks.
 
Shail Malik
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in of System.in is a variable of type InputStream but it refres to the object of PrintStream , by default it refers to the object of PrintStream but this can be changed to refer to any other object. so the command by default is
InputStream in=new PrintStream();
 
seema kamath
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for all the answers.I tried teh code given by Mr.Frank and i came to know that System.in is an object of BufferedInputStream.Thanks a lot for the information.
Mr.Maiilik tahnks a lot for answering me but I believe that it is System.out which is an object of PrintStream and not System.in.Since PrintStream helps you write to a destination It cannot be the class from which "in" is instantiated since "in" reads from a source.Please feel free to correct me if I'am wrong.
PS: I have changes my user name as well.
Thanks a lot to everybody involved with this site. It is too good.Extremely helpful for a beginner like me
Thank You
seema kamath
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for changing your name. I hope you come back often.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!