Just wondering System.out.println()

后端 未结 6 1849
故里飘歌
故里飘歌 2021-01-24 10:53

Just asking if I have the right understanding

System.out.println();

System is the package out is the class println() is the method

If t

相关标签:
6条回答
  • 2021-01-24 11:21

    No,

    • System is the class, which resides in java.lang package (that's why you don't need to import it).
    • out is a static variable of System class. It is public, so that you can access it from outside and it is static so that you it's associated to the class declaration and not to any instance of it.
    • println() is a method, indeed. And it is a method of out variable, which is a PrintStream instance.
    0 讨论(0)
  • 2021-01-24 11:25

    System is not a package. It is a class which is contained inside java.lang package

    Take a look here http://docs.oracle.com/javase/7/docs/api/java/lang/System.html

    out is a PrintStream object (static in case of System class) in which println() is one of the methods

    0 讨论(0)
  • 2021-01-24 11:28

    System is a class from package java.lang. out is a public, static member of System class, and println is a method, yes.

    0 讨论(0)
  • 2021-01-24 11:29

    out is a static object of printstream class
    System -class,

    PrintStream -class,

    out - static object of PrintStream class ,

    println - public method in PrintStream Class

    0 讨论(0)
  • 2021-01-24 11:29

    No, your understanding is wrong.

    "Then What is right" -

    System - a class,

    out - a static public member of type PrintStream ,

    and oh yes println() is a method.

    You were 33% right ;) read java documentation for this here

    0 讨论(0)
  • 2021-01-24 11:38
    System = class
    out = static object of the PrintStream class
    println() = method
    

    read this http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/System.html

    0 讨论(0)
提交回复
热议问题