鴻蒙OS InstantiationException

2022-05-31 16:49 更新

InstantiationException

java.lang.Object

|---java.lang.Throwable

|---|---java.lang.Exception

|---|---|---java.lang.ReflectiveOperationException

|---|---|---|---java.lang.InstantiationException

public class InstantiationException
extends ReflectiveOperationException

當(dāng)應(yīng)用程序嘗試使用類 Class 中的 newInstance 方法創(chuàng)建類的實(shí)例,但無(wú)法實(shí)例化指定的類對(duì)象時(shí)拋出。 實(shí)例化可能由于多種原因而失敗,包括但不限于:

  • 類對(duì)象表示抽象類、接口、數(shù)組類、原始類型或 void
  • 該類沒(méi)有空構(gòu)造函數(shù)

構(gòu)造函數(shù)摘要

構(gòu)造函數(shù) 描述
InstantiationException() 構(gòu)造一個(gè)沒(méi)有詳細(xì)消息的 InstantiationException。
InstantiationException(String s) 使用指定的詳細(xì)消息構(gòu)造一個(gè) InstantiationException。

方法總結(jié)

從類 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

構(gòu)造函數(shù)詳細(xì)信息

InstantiationException

public InstantiationException()

構(gòu)造一個(gè)沒(méi)有詳細(xì)消息的 InstantiationException。

InstantiationException

public InstantiationException(String s)

使用指定的詳細(xì)消息構(gòu)造一個(gè) InstantiationException。

參數(shù):

參數(shù)名稱 參數(shù)描述
s 詳細(xì)信息。
以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)