1

In the following statements, if System is a class and println() and print() are methods, then what is out?

System.out.print();
System.out.println();

I cannot understand the hierarchy. As in simple I have never used anything between class name and method name.

Maljam
  • 6,244
  • 3
  • 17
  • 30
Shankar
  • 2,890
  • 3
  • 25
  • 40

4 Answers4

2

out is a public static instance of the PrintStream class. println() and print() are methods of PrintStream class

Abhishek
  • 2,485
  • 2
  • 18
  • 25
1

out is a static member field of System class and is of type PrintStream.

Priyansh Goel
  • 2,660
  • 1
  • 13
  • 37
1

out is a static field of the System class. It is of type PrintStream which has a method println().

Nazaret K.
  • 3,409
  • 6
  • 22
  • 31
0

System is a final class which is present in java.lang package. out is the reference of PrintStream class and a static member of System class.

enter image description here

Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331