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

后端 未结 19 763
谎友^
谎友^ 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:21

    System is a class, that has a public static field out. So it's more like

    class System 
    {
        public static PrintStream out;
    }
    
    class PrintStream
    {
        public void println ...
    }
    

    This is a slight oversimplification, as the PrintStream class is actually in the java.io package, but it's good enough to show the relationship of stuff.

提交回复
热议问题