Java 源码赏析 - java.lang - Void
生活随笔
收集整理的這篇文章主要介紹了
Java 源码赏析 - java.lang - Void
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
被人鄙視了,于是也來讀讀源碼。。。
?
package java.lang;/*** The Void class is an uninstantiable placeholder class to hold a* reference to the Class object representing the Java keyword* void.** @author unascribed* @version %I%, %G%* @since JDK1.1*/ public final class Void {/*** The Class object representing the pseudo-type corresponding to* the keyword void.*/public static final Class<Void> TYPE = Class.getPrimitiveClass("void");/** The Void class cannot be instantiated.*/private Void() {} }原來Java里面有個Void類,是一個不可實例化的占位(placeholder)類,它持有一個Void類型的類變量來表示Java里面的關鍵字void。
Class.getPrimitiveClass() 原來還有這個方法,在什么場景下使用?
是不是所有的關鍵字都有對應的一個類呢?
這些關鍵字在編譯好的文件中是怎樣表示的?
Java解釋器又是怎樣工作的?
總結
以上是生活随笔為你收集整理的Java 源码赏析 - java.lang - Void的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 做梦梦到指甲盖裂开什么意思
- 下一篇: 梦到手机被偷了是什么预兆