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

后端 未结 19 764
谎友^
谎友^ 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.out.println("Hello World");
    
    1. System: It is the name of standard class that contains objects that encapsulates the standard I/O devices of your system.

    It is contained in the package java.lang. Since java.lang package is imported in every java program by default,therefore java.lang package is the only package in Java API which does not require an import declaration.

    1. out:The object out represents output stream(i.e Command window)and is the static data member of the class System.

    So note here System.out (System -Class & out- static object i.e why its simply referred to by classname and we need not create any object).

    1. println:The println() is method of out object that takes the text string as an argument and displays it to the standard output i.e on monitor screen.

    Note
    System -Class
    out -static Object
    println() -method
    Remember a function (in java function is called method) always has the format function()

提交回复
热议问题