1. 程式人生 > >void天吶

void天吶

一、概述

void是java中的關鍵字

(一般方法定義時用void修飾,表示沒有返回值)

package java.lang;

/**
 * The {@code Void} class is an uninstantiable placeholder class to hold a
 * reference to the {@code Class} object representing the Java keyword
 * void.
 *
 * @author  unascribed
 * @since   JDK1.1
 */
public final class Void {

    /**
     * The {@code Class} object representing the pseudo-type corresponding to
     * the keyword {@code void}.
     */
    @SuppressWarnings("unchecked")
    public static final Class<Void> TYPE = (Class<Void>) Class.getPrimitiveClass("void");

    /*
     * The Void class cannot be instantiated.
     */
    private Void() {}
}

java.lang.Void 類是一個不可例項化的佔位符類,用於儲存對錶示Java關鍵字void的Class物件的引用

 

二、Reference

java中的void是什麼

Java 關鍵字

Java void關鍵字