优惠码 第72页

鸿蒙OS RuntimeException

RuntimeException java.lang.Object |—java.lang.Throwable |—|—java.lang.Exception |—|—|—java.lang.RuntimeException public class RuntimeException extends Exception RuntimeException 是可以在 Java 虚拟机正常运行期间抛出的那些异常的超类。 RuntimeException 及其子类是未经检查的异常。 如果未经检查的异常可以通过方法或构造函数的执行抛出并传播到方法或构造函数边界之外,则不需要在方法或构造函数的 throws 子句中声明它们。 构造函数摘要 修饰符 构造函数 描述 RuntimeException() 构造一个新的运行时异常,并将 null 作为其详细消息。 RuntimeException(String message) 使用指定的详细消息构造一个新的运行时异常。 RuntimeException(String message, Throwable cause) 使用指定的详细消息和原因构造一个新的运行时异常。 protected RuntimeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) 使用指定的详细消息、原因、启用或禁用抑制以及启用或禁用可写堆栈跟踪构造一个新的运行时异常。 RuntimeException(Throwable cause) 使用指定的原因和 (cause==null ? null : cause.toString()) 的详细消息构造一个新的运行时异常(通常包含原因的类和详细消息)。 方法总结 从类 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 构造函数详细信息 RuntimeException public RuntimeException() 构造一个新的运行时异常,并将 null 作为其详细消息。 原因未初始化,随后可能通过调用 Throwable.initCause(java.lang.Throwable) 进行初始化。 RuntimeException public RuntimeException(String message) 使用指定的详细消息构造一个新的运行时异常。 原因未初始化,随后可能通过调用 Throwable.initCause(java.lang.Throwable) 进行初始化。 参数: 参数名称 参数描述 message 详细信息。 保存详细消息以供 Throwable.getMessage() 方法稍后检索。 RuntimeException public RuntimeException(String message, Throwable cause) 使用指定的详细消息和原因构造一个新的运行时异常。 请注意,与原因关联的详细消息不会自动合并到此运行时异常的详细消息中。 参数: 参数名称 参数描述 message 详细消息(保存以供 Throwable.getMessage() 方法稍后检索)。 cause 原因(由 Throwable.getCause() 方法保存以供以后检索)。 (允许使用空值,表示原因不存在或未知。) RuntimeException public RuntimeException(Throwable cause) 使用指定的原因和 (cause==null ? null : cause.toString()) 的详细消息构造一个新的运行时异常(通常包含原因的类和详细消息)。 这个构造函数对于运行时异常非常有用,它们只不过是其他 throwable 的包装器。 参数: 参数名称 参数描述 cause 原因(由 Throwable.getCause() 方法保存以供以后检索)。 (允许使用空值,表示原因不存在或未知。) RuntimeException protected RuntimeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) 使用指定的详细消息、原因、启用或禁用抑制以及启用或禁用可写堆栈跟踪构造一个新的运行时异常。 参数: 参数名称 参数描述 message 详细信息。 cause 原因。 (允许使用空值,表示原因不存在或未知。) enableSuppression 是否启用或禁用抑制...

鸿蒙OS ReflectiveOperationException

ReflectiveOperationException java.lang.Object |—java.lang.Throwable |—|—java.lang.Exception |—|—|—java.lang.ReflectiveOperationException public class ReflectiveOperationException extends Exception 核心反射中反射操作抛出的常见异常超类。 构造函数摘要 构造函数 描述 ReflectiveOperationException() 构造一个以 null 作为其详细消息的新异常。 ReflectiveOperationException(String message) 使用指定的详细消息构造一个新异常。 ReflectiveOperationException(String message, Throwable cause) 使用指定的详细消息和原因构造一个新异常。 ReflectiveOperationException(Throwable cause) 构造一个具有指定原因的新异常和 (cause==null ? null : cause.toString()) 的详细消息(通常包含原因的类和详细消息)。 方法总结 从类 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 构造函数详细信息 ReflectiveOperationException public ReflectiveOperationException() 构造一个以 null 作为其详细消息的新异常。 原因未初始化,随后可能通过调用 Throwable.initCause(java.lang.Throwable) 进行初始化。 ReflectiveOperationException public ReflectiveOperationException(String message) 使用指定的详细消息构造一个新异常。 原因未初始化,随后可能通过调用 Throwable.initCause(java.lang.Throwable) 进行初始化。 参数: 参数名称 参数描述 message 详细信息。 保存详细消息以供 Throwable.getMessage() 方法稍后检索。 ReflectiveOperationException public ReflectiveOperationException(String message, Throwable cause) 使用指定的详细消息和原因构造一个新异常。 请注意,与原因相关的详细消息不会自动合并到此异常的详细消息中。 参数: 参数名称 参数描述 message 详细消息(保存以供 Throwable.getMessage() 方法稍后检索)。 cause 原因(由 Throwable.getCause() 方法保存以供以后检索)。 (允许使用空值,表示原因不存在或未知。) ReflectiveOperationException public ReflectiveOperationException(Throwable cause) 构造一个具有指定原因的新异常和 (cause==null ? null : cause.toString()) 的详细消息(通常包含原因的类和详细消息)。 参数: 参数名称 参数描述 cause 原因(由 Throwable.getCause() 方法保存以供以后检索)。 (允许使用空值,表示原因不存在或未知。)

鸿蒙OS NumberFormatException

NumberFormatException java.lang.Object |—java.lang.Throwable |—|—java.lang.Exception |—|—|—java.lang.RuntimeException |—|—|—|—java.lang.IllegalArgumentException |—|—|—|—|—java.lang.NumberFormatException public class NumberFormatException extends IllegalArgumentException 抛出以指示应用程序已尝试将字符串转换为其中一种数字类型,但该字符串没有适当的格式。 构造函数摘要 构造函数 描述 NumberFormatException() 构造一个没有详细消息的 NumberFormatException。 NumberFormatException(String s) 构造带有指定详细消息的 NumberFormatException。 方法总结 从类 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 构造函数详细信息 NumberFormatException public NumberFormatException() 构造一个没有详细消息的 NumberFormatException。 NumberFormatException public NumberFormatException(String s) 构造带有指定详细消息的 NumberFormatException。 参数: 参数名称 参数描述 s 详细信息。

鸿蒙OS NullPointerException

NullPointerException java.lang.Object |—java.lang.Throwable |—|—java.lang.Exception |—|—|—java.lang.RuntimeException |—|—|—|—java.lang.NullPointerException public class NullPointerException extends RuntimeException 当应用程序在需要对象的情况下尝试使用 null 时引发。 这些包括: 调用空对象的实例方法。 访问或修改空对象的字段。 将 null 的长度视为一个数组。 访问或修改 null 的槽,就像它是一个数组一样。 将 null 视为 Throwable 值。 应用程序应抛出此类的实例以指示空对象的其他非法使用。 NullPointerException 对象可以由虚拟机构造,就像 Throwable#Throwable(String, Throwable, boolean, boolean)。 构造函数摘要 构造函数 描述 NullPointerException() 构造一个没有详细消息的 NullPointerException。 NullPointerException(String s) 构造带有指定详细消息的 NullPointerException。 方法总结 从类 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 构造函数详细信息 NullPointerException public NullPointerException() 构造一个没有详细消息的 NullPointerException。 NullPointerException public NullPointerException(String s) 构造带有指定详细消息的 NullPointerException。 参数: 参数名称 参数描述 s 详细信息。

鸿蒙OS NoSuchMethodException

NoSuchMethodException java.lang.Object |—java.lang.Throwable |—|—java.lang.Exception |—|—|—java.lang.ReflectiveOperationException |—|—|—|—java.lang.NoSuchMethodException public class NoSuchMethodException extends ReflectiveOperationException 当找不到特定方法时抛出。 构造函数摘要 构造函数 描述 NoSuchMethodException() 构造一个没有详细消息的 NoSuchMethodException。 NoSuchMethodException(String s) 构造带有详细消息的 NoSuchMethodException。 方法总结 从类 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 构造函数详细信息 NoSuchMethodException public NoSuchMethodException() 构造一个没有详细消息的 NoSuchMethodException。 NoSuchMethodException public NoSuchMethodException(String s) 构造带有详细消息的 NoSuchMethodException。 参数: 参数名称 参数描述 s 详细信息。

鸿蒙OS NoSuchFieldException

NoSuchFieldException java.lang.Object |—java.lang.Throwable |—|—java.lang.Exception |—|—|—java.lang.ReflectiveOperationException |—|—|—|—java.lang.NoSuchFieldException public class NoSuchFieldException extends ReflectiveOperationException 表示该类没有指定名称的字段。 构造函数摘要 构造函数 描述 NoSuchFieldException() 构造函数。 NoSuchFieldException(String s) 带有详细消息的构造函数。 方法总结 从类 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 构造函数详细信息 NoSuchFieldException public NoSuchFieldException() 构造函数。 NoSuchFieldException public NoSuchFieldException(String s) 带有详细消息的构造函数。 参数: 参数名称 参数描述 s 详细信息

鸿蒙OS NegativeArraySizeException

NegativeArraySizeException java.lang.Object |—java.lang.Throwable |—|—java.lang.Exception |—|—|—java.lang.RuntimeException |—|—|—|—java.lang.NegativeArraySizeException public class NegativeArraySizeException extends RuntimeException 如果应用程序尝试创建具有负大小的数组,则抛出此异常。 构造函数摘要 构造函数 描述 NegativeArraySizeException() 构造一个没有详细消息的 NegativeArraySizeException。 NegativeArraySizeException(String s) 构造带有指定详细消息的 NegativeArraySizeException。 方法总结 从类 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 构造函数详细信息 NegativeArraySizeException public NegativeArraySizeException() 构造一个没有详细消息的 NegativeArraySizeException。 NegativeArraySizeException public NegativeArraySizeException(String s) 构造带有指定详细消息的 NegativeArraySizeException。 参数: 参数名称 参数描述 s 详细信息。

鸿蒙OS InterruptedException

InterruptedException java.lang.Object |—java.lang.Throwable |—|—java.lang.Exception |—|—|—java.lang.InterruptedException public class InterruptedException extends Exception 当线程等待、休眠或以其他方式被占用,并且线程在活动之前或期间被中断时抛出。 有时某个方法可能希望测试当前线程是否已被中断,如果是,则立即抛出此异常。 下面的代码可以用来实现这个效果: if (Thread.interrupted()) // Clears interrupted status! throw new InterruptedException(); 构造函数摘要 构造函数 描述 InterruptedException() 构造一个没有详细消息的 InterruptedException。 InterruptedException(String s) 构造带有指定详细消息的 InterruptedException。 方法总结 从类 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 构造函数详细信息 InterruptedException public InterruptedException() 构造一个没有详细消息的 InterruptedException。 InterruptedException public InterruptedException(String s) 构造带有指定详细消息的 InterruptedException。 参数: 参数名称 参数描述 s 详细信息。

鸿蒙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 详细信息。

鸿蒙OS IndexOutOfBoundsException

IndexOutOfBoundsException java.lang.Object |—java.lang.Throwable |—|—java.lang.Exception |—|—|—java.lang.RuntimeException |—|—|—|—java.lang.IndexOutOfBoundsException public class IndexOutOfBoundsException extends RuntimeException 抛出以指示某种索引(例如数组、字符串或向量)超出范围。 应用程序可以对此类进行子类化以指示类似的异常。 构造函数摘要 构造函数 描述 IndexOutOfBoundsException() 构造一个没有详细消息的 IndexOutOfBoundsException。 IndexOutOfBoundsException(String s) 使用指定的详细消息构造 IndexOutOfBoundsException。 方法总结 从类 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 构造函数详细信息 IndexOutOfBoundsException public IndexOutOfBoundsException() 构造一个没有详细消息的 IndexOutOfBoundsException。 IndexOutOfBoundsException public IndexOutOfBoundsException(String s) 使用指定的详细消息构造 IndexOutOfBoundsException。 参数: 参数名称 参数描述 s 详细信息。