⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 11.doc.html

📁 java语言规范
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<a name="49959"></a>
<li><code>IllegalThreadStateException:</code> A thread was not in an appropriate state for a requested operation.
<a name="49960"></a>
<li><code>NumberFormatException</code>: An attempt was made to convert a <code>String</code> to a value of a numeric type, but the <code>String</code> did not have an appropriate format.
</ul>
<a name="44308"></a>
<li><code>IllegalMonitorStateException</code>: A thread has attempted to wait on (<a href="javalang.doc1.html#33394">&#167;20.1.6</a>, <a href="javalang.doc1.html#14926">&#167;20.1.7</a>, <a href="javalang.doc1.html#32520">&#167;20.1.8</a>) or notify (<a href="javalang.doc1.html#13789">&#167;20.1.9</a>, <a href="javalang.doc1.html#13790">&#167;20.1.10</a>) other threads waiting on an object that it has not locked.
<a name="44315"></a>
<li><code>IndexOutOfBoundsException</code>: Either an index of some sort (such as to an array, a string, or a vector) or a subrange, specified either by two index values or by an index and a length, was out of range.
<a name="44316"></a>
<li><code>NegativeArraySizeException</code>: An attempt was made to create an array with a negative length <a href="15.doc.html#46168">(&#167;15.9)</a>.
<a name="44320"></a>
<li><code>NullPointerException</code>: An attempt was made to use a null reference in a case where an object reference was required.
<a name="44324"></a>
<li><code>SecurityException</code>: A security violation was detected <a href="javalang.doc16.html#46274">(&#167;20.17)</a>.
</ul><a name="44325"></a>
Package <code>java.util</code> defines the following additional standard unchecked runtime 
exceptions:
<p><ul><a name="44326"></a>
<li><code>java.util.EmptyStackException</code>: An attempt was made to access an element of an empty stack.
<a name="44327"></a>
<li><code>java.util.NoSuchElementException</code>: An attempt was made to access an element of an empty vector.
</ul><a name="44328"></a>
<h4>11.5.1.2    Standard Checked Exceptions</h4>
<a name="44329"></a>
The standard subclasses of <code>Exception</code> other than <code>RuntimeException</code> are all 
checked exception classes.
<p><a name="44330"></a>
Package <code>java.lang</code> defines the following standard exceptions, which, like all other classes in package <code>java.lang</code>, are implicitly imported and therefore may be referred to by their simple names:<p>
<ul><a name="44331"></a>
<li><code>ClassNotFoundException</code>: A class or interface with a specified name could not be found <a href="javalang.doc2.html#28532">(&#167;20.3.8)</a>.
<a name="44338"></a>
<li><code>CloneNotSupportedException</code>: The <code>clone</code> method <a href="javalang.doc1.html#14934">(&#167;20.1.5)</a> of class <code>Object</code> &#32;has been invoked to clone an object, but the class of that object does not implement the <code>Cloneable</code> interface.
<a name="44339"></a>
<li><code>IllegalAccessException</code>: An attempt has been made to load a class using a string giving its fully qualified name, but the currently executing method does not have access to the definition of the specified class because the class is not <code>public</code> and is in another package.
<a name="44340"></a>
<li><code>InstantiationException</code>: An attempt was made to create an instance of a class using the <code>newInstance</code> method in class <code>Class</code>, but the specified class object cannot be instantiated because it is an interface, is <code>abstract</code>, or is an array.
<a name="44341"></a>
<li><code>InterruptedException</code>: The current thread was waiting, and another thread has interrupted the current thread, using the <code>interrupt</code> method of class <code>Thread</code> <a href="javalang.doc18.html#29179">(&#167;20.20.31)</a>.
</ul><a name="44345"></a>
Package <code>java.io</code> defines the following additional standard exceptions:
<p><ul><a name="44346"></a>
<li><code>java.io.IOException</code>: A requested I/O operation could not be completed normally. Subclasses of this class include:
<ul>
<a name="44347"></a>
<li><code>java.io.EOFException</code>: End of file has been encountered before normal completion of an input operation.
<a name="44348"></a>
<li><code>java.io.FileNotFoundException</code>: A file with the name specified by a file name string or path was not found within the file system.
<a name="44349"></a>
<li><code>java.io.InterruptedIOException</code>: The current thread was waiting for completion of an I/O operation, and another thread has interrupted the current thread, using the <code>interrupt</code> method of class <code>Thread</code> <a href="javalang.doc18.html#29179">(&#167;20.20.31)</a>.
<a name="44353"></a>
<li><code>java.io.UTFDataFormatException</code>: A requested conversion of a string to or from Java modified UTF-8 format could not be completed (<a href="javaio.doc.html#28916">&#167;22.1.15</a>, <a href="javaio.doc.html#29074">&#167;22.2.14</a>) because the string was too long or because the purported UTF-8 data was not the result of encoding a Unicode string into UTF-8.
</ul>
</ul><a name="44360"></a>
The standard package <code>java.net</code> defines the following additional subclasses of 
<code>java.io.IOException</code>:
<p><a name="44361"></a>
u	 <code>java.net.MalformedURLException</code>: A string that was provided as a URL, or as part of a URL, had an inappropriate format or specified an unknown protocol.<p>
<ul><ul>
<a name="44362"></a>
<li><code>java.net.ProtocolException</code>: Some aspect of a network protocol was not correctly carried out.
<a name="44363"></a>
<li><code>java.net.SocketException</code>: An operation involving a socket could not be completed normally.
<a name="44364"></a>
<li><code>java.net.UnknownHostException</code>: The name of a network host could not be resolved to a network address.
<a name="44365"></a>
<li><code>java.net.UnknownServiceException</code>: The network connection cannot support the requested service.
</ul>
</ul><a name="44367"></a>
<h3>11.5.2    The Class <code>Error</code></h3>
<a name="44368"></a>
The class <code>Error</code> and its standard subclasses are exceptions from which ordinary 
programs are not ordinarily expected to recover. The class <code>Error</code> is a separate 
subclass of <code>Throwable</code>, distinct from <code>Exception</code> in the class hierarchy, to allow 
programs to use the idiom:
<p><pre><a name="44369"></a>} catch (Exception e) {
</pre><a name="44370"></a>
to catch all exceptions from which recovery may be possible without catching 
errors from which recovery is typically not possible.
<p><a name="44371"></a>
Package <code>java.lang</code> defines all the error classes described here. These classes, like all other classes in package <code>java.lang</code>, are implicitly imported and therefore may be referred to by their simple names.<p>
<a name="44372"></a>
<h4>11.5.2.1    Loading and Linkage Errors</h4>
<a name="44373"></a>
A Java Virtual Machine throws an object that is an instance of a subclass of 
<code>LinkageError</code> &#32;when a loading, linkage, preparation, verification or initialization 
error occurs:
<p><ul><a name="44377"></a>
<li>The loading process is described in <a href="12.doc.html#44459">&#167;12.2</a>. The errors <code>ClassFormatError</code>, <code>ClassCircularityError</code>, and <code>NoClassDefFoundError</code> are described there.
<a name="47893"></a>
<li>The linking process is described in <a href="12.doc.html#44487">&#167;12.3</a>. The linking errors are described there. These errors include <code>IllegalAccessError</code>,<code> InstantiationError</code>, <code>NoSuchFieldError</code>, and <code>NoSuchMethodError</code>, all of which are subclasses of <code>IncompatibleClassChangeError</code>, and, also, <code>UnsatisfiedLinkError</code>.
<a name="47897"></a>
<li>The class verification process is described in <a href="12.doc.html#44491">&#167;12.3.1</a>. The verification failure error <code>VerifyError</code> is described there.
<a name="44389"></a>
<li>The class preparation process is described in <a href="12.doc.html#47979">&#167;12.3.2</a>. The preparation error described there is <code>AbstractMethodError</code>.
<a name="44393"></a>
<li>The class initialization process is described in <a href="12.doc.html#44557">&#167;12.4</a>. A virtual machine will throw the error <code>ExceptionInInitializerError</code> if execution of a static initializer or of an initializer for a <code>static</code> field results in an exception that is not an <code>Error</code> or a subclass of <code>Error</code>.
</ul><a name="44395"></a>
<h4>11.5.2.2    Virtual Machine Errors</h4>
<a name="44396"></a>
A Java Virtual Machine throws an object that is an instance of a subclass of the 
class <code>VirtualMachineError</code> when an internal error or resource limitation prevents
it from implementing the semantics of the Java Language. This language 
specification and the Java Virtual Machine Specification define the following virtual
machine errors:
<p><ul><a name="44397"></a>
<li><code>InternalError</code>: An internal error has occurred in a Java Virtual Machine, because of a fault in the software implementing the virtual machine, a fault in the underlying host system software, or a fault in the hardware. This error is delivered asynchronously when it is detected, and may occur at any point in a Java program.
<a name="44398"></a>
<li><code>OutOfMemoryError</code>: A Java Virtual Machine has run out of either virtual or physical memory, and the automatic storage manager wasn't able to reclaim enough memory to satisfy an object creation request.
<a name="44399"></a>
<li><code>StackOverflowError</code>: A Java Virtual Machine has run out of stack space for a thread, typically because the thread is doing an unbounded number of recursive invocations due to a fault in the executing program.
<a name="44400"></a>
<li><code>UnknownError</code>: An exception or error has occurred but, for some reason, a Java Virtual Machine is unable to report the actual exception or error.
</ul><a name="44401"></a>
A sophisticated Java program may be designed to handle <code>OutOfMemoryError</code> and 
attempt to recover from it, perhaps by carefully dropping references to objects.
<p><a name="47538"></a>
We are exploring enhancements to Java to simplify handling of out-of-memory conditions. One possibility would be to support automatic suspension of a thread which encounters an <code>OutOfMemoryError</code> and allow another thread to handle the <code>error</code> situation. Such a technique might also permit a Java program to recover from a <code>StackOverflowError</code> if this overflow does not result from a nonterminating recursion. Suggestions for other approaches are welcomed.<p>
<a name="55170"></a>
<p>


<hr>
<!-- This inserts footnotes--><p>
<a href="index.html">Contents</a> | <a href="10.doc.html">Prev</a> | <a href="12.doc.html">Next</a> | <a href="j.index.doc1.html">Index</a>
<p>
<font size=-1>Java Language Specification (HTML generated by Suzette Pelouch on February 24, 1998)<br>
<i><a href="jcopyright.doc.html">Copyright &#169 1996 Sun Microsystems, Inc.</a>
All rights reserved</i>
<br>
Please send any comments or corrections to <a href="mailto:doug.kramer@sun.com">doug.kramer@sun.com</a>
</font>
</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -