InputStream
is the type of System.in
, and not it's class (since InputStream
cannot be directly instantiated as it is abstract).
Consider:
Object obj = "123";
The type of the variable obj
is Object
, but the instance referenced by obj
is an instance of String
. When toString()
is called on obj
the implementation in String
is used, and not the implementation in Object
.
The same goes for System.in
. The actual instance stored there will be some subclass of InputStream
, which will have its own implementation of any abstract methods. If you want to know the class of the instance stored in System.in
then you can call System.in.getClass()
.