可能的重复:
Java中System.out.println的含义是什么? https://stackoverflow.com/questions/3406703/whats-the-meaning-of-system-out-println-in-java
我一直在寻找什么的答案System
, out
and println
are in System.out.println()
在爪哇。我搜索并找到了一个不同的答案,如下所示:
System is a built-in class present in java.lang package.
This class has a final modifier, which means that, it cannot be inherited by other classes.
It contains pre-defined methods and fields, which provides facilities like standard input, output, etc.
out is a static final field (ie, variable)in System class which is of the type PrintStream (a built-in class, contains methods to print the different data values).
static fields and methods must be accessed by using the class name, so ( System.out ).
out here denotes the reference variable of the type PrintStream class.
println() is a public method in PrintStream class to print the data values.
Hence to access a method in PrintStream class, we use out.println() (as non static methods and fields can only be accessed by using the refrence varialble)
在另一页中,我找到了另一个对比定义:
System.out.print是java中使用的标准输出函数。其中 System 指定包名称,out 指定类名称,print 是该类中的函数。
我对这些很困惑。有人能准确地告诉我它们是什么吗?
System
是最后一堂课java.lang
包裹。
out
是类型的类变量PrintStream
声明于System
class.
println
是一种方法PrintStream
class.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)