I'm new to programming and I just started learning Java. I'm curious that does the object System.out belong to class System or class PrintStream?
I referred to a textbook, JAVA CONCEPTS 4/e. The textbook states that to use the out object in the System class, you must refer it as System.out
but later in the book it states that the System.out
belongs to class PrintStream.
I've searched google and stackoverflow but all the answers are too hard for me to understand.
It is defined as:
"out" belongs to class "System" and is of type "PrintStream" :)
System.out
is aPrintStream
object. It is defined inSystem
(so, it is member ofSystem
) class as :See: http://docs.oracle.com/javase/6/docs/api/java/lang/System.html
out
is a static field in System. Its type is PrintStream.In loose simple terms, 'out' is a field (i.e. an object) in class 'System' of type 'PrintStream'.
Out is the static reference variable in class System and is of PrintStream(class) type.