void天呐

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_36163918/article/details/86476368

一、概述

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关键字

猜你喜欢

转载自blog.csdn.net/qq_36163918/article/details/86476368