This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
In java.lang.System it is defined as a reference to the "InputStream" interface. On printing it - using a simple print like so: System.out.println( System.in ); it says it is of type "java.io.BufferedInputStream". But BufferedInputStream is a decorator - I want to know who is the decoree. Examaning the class object or using instanceof to does not help since the decoree is contained in the decorator. Can anyone suggest a way I can find out the type of System.in? Thanks in advance.
I was under the impression that it would wrap one of the polular public class from java.io like: ByteArrayInputStream / PipedInputStream etc.. I am not stuck with a problem or anything, I was plainly curious of the implementation of: System.out and System.in :-)
You can download the source code for the SDK and peruse through the .java files if you are interested. I do that myself every now and then when bored or curious of how things are really implemented under the hood. It's nice not having to worry about implementation details, but it is sometimes fun to find them out!