晴川云鸿蒙OS教程:鸿蒙OS InstantiationException

InstantiationException

java.lang.Object

|—java.lang.Throwable

|—|—java.lang.Exception

|—|—|—java.lang.ReflectiveOperationException

|—|—|—|—java.lang.InstantiationException

public class InstantiationException
extends ReflectiveOperationException

当应用程序尝试使用类 Class 中的 newInstance 方法创建类的实例,但无法实例化指定的类对象时抛出。 实例化可能由于多种原因而失败,包括但不限于:

  • 类对象表示抽象类、接口、数组类、原始类型或 void
  • 该类没有空构造函数

构造函数摘要

构造函数 描述
InstantiationException() 构造一个没有详细消息的 InstantiationException。
InstantiationException(String s) 使用指定的详细消息构造一个 InstantiationException。

方法总结

从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
从类 java.lang.Throwable 继承的方法
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString

构造函数详细信息

InstantiationException

public InstantiationException()

构造一个没有详细消息的 InstantiationException。

InstantiationException

public InstantiationException(String s)

使用指定的详细消息构造一个 InstantiationException。

参数:

参数名称 参数描述
s 详细信息。

原创文章,作者:晴川运维,如若转载,请注明出处:https://baike.qcidc.com/3066.html

(0)
晴川运维晴川运维
上一篇 2025年6月1日
下一篇 2025年6月1日

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注