aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes What exactly is System.in? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "What exactly is System.in?" Watch "What exactly is System.in?" New topic
Author

What exactly is System.in?

Ernest Lee
Ranch Hand

Joined: Aug 20, 2001
Posts: 145
The System.in is declared as
"public static final InputStream in"...
but InputStream is an abstract class so it cannot be instaniated... so.. what is System.in?
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
in fact System.in is initialized with the static member in of FileDescriptor (FileDescriptor.in).
In the System class, in is further initializedas a FileInputStream wrapped around that FileDescriptor

As you can see, System.in is a BufferedInputStream wrapped around a FileInputStream which in turn wraps a FileDescriptor...
You don't really need to know what type is System.in of, but it's good practice to look inside the sources...
HIH

------------------
Valentin Crettaz
Sun Certified Programmer for Java 2 Platform


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What exactly is System.in?
 
Similar Threads
standard in failing after replacing
how is System.in an object?
Will these methods wait for input?
System.in an object ...how ??
Help with my code