我在寻找System、out和println在System.out.println()中的应用的答案。我搜索了一个不同的答案,就像这样:
在另一页中,我发现另一个截然不同的定义是
System.out.print是java中使用的标准输出函数。其中,系统指定包名,out指定类名,而print是该类中的函数。
我被这些弄糊涂了。有人能告诉我它们是什么吗?
发布于 2012-08-17 08:22:30
你发布的第一个答案(系统是一个内置的课程.)很不错的地方。
您可以添加System类包含大量本地部分,这些部分是JVM在启动时设置的,例如将System.out打印流连接到与“标准输出”(控制台)相关联的本机输出流。
发布于 2012-08-17 08:23:00
System是来自java.lang包的最后一个类。
out是在System类中声明的类型为PrintStream的类变量。
println是PrintStream类的一种方法。
发布于 2012-08-17 08:22:22
当你感到困惑的时候,我建议先咨询Javadoc,作为你澄清的第一个地方。
在关于System的javadoc中,下面是文档中的内容:
public final class System
extends Object
The System class contains several useful class fields and methods. It cannot be instantiated.
Among the facilities provided by the System class are standard input, standard output, and error output streams; access to externally defined properties and environment variables; a means of loading files and libraries; and a utility method for quickly copying a portion of an array.
Since:
JDK1.0关于System.out
public static final PrintStream out
The "standard" output stream. This stream is already open and ready to accept output data. Typically this stream corresponds to display output or another output destination specified by the host environment or user.
For simple stand-alone Java applications, a typical way to write a line of output data is:
System.out.println(data)https://stackoverflow.com/questions/12002170
复制相似问题