java System.out

System.out.println(); 是刚学java就接触的东西, 但是有些东西到现在才开始思考

首先说out , System.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)
     * 
*

* See the println methods in class PrintStream. * * @see java.io.PrintStream#println() * @see java.io.PrintStream#println(boolean) * @see java.io.PrintStream#println(char) * @see java.io.PrintStream#println(char[]) * @see java.io.PrintStream#println(double) * @see java.io.PrintStream#println(float) * @see java.io.PrintStream#println(int) * @see java.io.PrintStream#println(long) * @see java.io.PrintStream#println(java.lang.Object) * @see java.io.PrintStream#println(java.lang.String) */ public final static PrintStream out = null;

常见的使用方式,在out的注解里都写了,这里就不多做赘述了.

这是jdk中System类的源码与注释, 可以看出这个out对象虽然为空,但是是在启动时就初始化好的, 其初始化位置为:

 /* register the natives via the static initializer.
     *
     * VM will invoke the initializeSystemClass method to complete
     * the initialization for this class separated from clinit.
     * Note that to use properties set by the VM, see the constraints
     * described in the initializeSystemClass method.
     */
    private static native void registerNatives();
    static {
        registerNatives();
    }

可以明显的看出,该方法是native的 , 这样就不用继续看了,就到这里了,本地方法,就不一定是啥东西了

不过我还是想说一句:第三行最后一个单词clinit 这个单词到底是什么意思, 是写错了吗?  求大神留言 

你可能感兴趣的:(java,java,System.out)