I am just a newbie in Java. I was wondering the way System.out.println()
is used. Out is a static field inside System
class. The type of out
is PrintStream
. But when I saw the constructor of PrintStream
class, it takes a parameter of type OutputStream
and as far as I know we cannot create the object of an abstract class. In that case we must pass some subclass's object to the constructor of PrintStream
. What is that class? Same is the System.in
. It is also InputStream
's reference but what is the type of object it points to as the InputStream
is abstract?
PrintStream
wraps BufferedOutputStream
, which wraps FileOutputStream
, which is writing into the console, which has its own FileDescriptor
.