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,158
  • 3
  • 15
  • 30
Irony Stack
  • 2,700
  • 3
  • 24
  • 38

4 Answers4

2

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

Abhishek
  • 2,427
  • 2
  • 17
  • 24
1

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

Priyansh Goel
  • 2,629
  • 1
  • 12
  • 36
1

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

Nazaret K.
  • 3,249
  • 6
  • 21
  • 30
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
  • 161,154
  • 30
  • 262
  • 319