直接上结论:无参构造被修饰为private,也没有其它构造。所以不可以new对象
下图为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() {}
}
同时还有不可被继承,当一个类被声明为final
时,它表示这个类是最终的,不能被任何子类所继承。这是为了确保final
类中的实现是不可以被改变的,或者它们代表了完全不可扩展的类。如果你尝试继承一个final
类,编译器将会报错,指出不能继承一个final
类。