InputStream is an Abstract class.Then how are we able to access System.in.And moreover int read() is an abstract method in InputStream class.Then how are we able to access S
I suggest you to read more about abstraction and inheritance methods in Java.
If you extend an abstract class, you have to implement its abstract methods. This way, you provide an implementation for it, which can be called by consumers.
System.in
is an instance of a class which extends InputStream
, not of InputStream
directly.