What's the meaning of System.out.println in Java?

后端 未结 19 776
谎友^
谎友^ 2020-11-27 11:49

Is this static println function in out class from System namespace?

namespace System {
  class out {
    static println ...         


        
19条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-27 12:26

    println and print are the two overloaded methods which belong to the PrintStream class.

    To access them we need an instance of this class.

    A static property called out of type PrintStream is created on the System class.

    Hence to access the above methods we use the following statements:

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

提交回复
热议问题