什么是Java中的System.out.println()中的System,out,println [英] What is System, out, println in System.out.println() in Java

查看:606
本文介绍了什么是Java中的System.out.println()中的System,out,println的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

Java中System.out.println的含义是什么?

我一直在寻找系统 out 和<$的答案c $ c> println 在Java中的 System.out.println()中。我搜索并找到了这样的不同答案:

I was looking for the answer of what System, out and println are in System.out.println() in the Java. I searched and found a different answer like these:



系统是一个内置类礼物在java.lang包中。
这个类有一个final修饰符,这意味着它不能被其他类继承。
它包含预定义的方法和字段,提供标准输入,输出等功能。

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是System类中的静态final字段(即变量),其类型为PrintStream(内置类,包含打印不同数据值的方法)。必须使用类名访问
    静态字段和方法,因此(System.out)。

    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这里表示PrintStream类的引用变量。

    out here denotes the reference variable of the type PrintStream class.



  • println()是PrintStream类中用于打印数据值的公共方法。
    因此,要访问PrintStream类中的方法,我们使用out.println()(因为非静态方法和字段只能通过使用refrence varialble访问)

    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)


  • 在另一个页面中,我发现另一个对比定义为

    In another page i find another contrasting definition as


    System.out.print是java中使用的标准输出函数。其中System指定包名,out指定类名,print是该类中的一个函数。

    System.out.print is a standard output function used in java. where System specifies the package name, out specifies the class name and print is a function in that class.

    我对这些感到困惑。有人可以告诉我它们是什么吗?

    I am confused by these. Could anybody please exactly tell me what they are?

    推荐答案

    你发布的第一个答案(系统是一个内置类.. 。)非常适合。

    The first answer you posted (System is a built-in class...) is pretty spot on.

    您可以添加系统类包含大部分本机和由JVM在启动期间设置,例如将 System.out printstream连接到与标准输出(控制台)关联的本机输出流。

    You can add that the System class contains large portions which are native and that is set up by the JVM during startup, like connecting the System.out printstream to the native output stream associated with the "standard out" (console).

    这篇关于什么是Java中的System.out.println()中的System,out,println的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆