📄 javalang.doc21.html
字号:
<html>
<head>
<title>The Java Language Specification The Package java.lang </title>
</head>
<body BGCOLOR=#eeeeff text=#000000 LINK=#0000ff VLINK=#000077 ALINK=#ff0000>
<a href="index.html">Contents</a> | <a href="javalang.doc20.html">Prev</a> | <a href="javautil.doc.html">Next</a> | <a href="j.index.doc1.html">Index</a>
<hr><br>
<a name="43231"></a>
<center><h1>20.23 The Class <br><code>java.lang.ExceptionInInitializerError</code></h1></center>
<a name="36093"></a>
An <code>ExceptionInInitializerError</code> is thrown to indicate that an exception
occurred during evaluation of a static initializer or the initializer for a <code>static</code>
variable <a href="12.doc.html#44630">(§12.4.2)</a>.
<p><pre><a name="35740"></a>public class <code><b>ExceptionInInitializerError
</b></code><a name="35764"></a> extends RuntimeException {
<a name="35741"></a> public <code><b>ExceptionInInitializerError</b></code>();
<a name="35774"></a> public <code><b>ExceptionInInitializerError</b></code>(String s);
<a name="35776"></a> public <code><b>ExceptionInInitializerError</b></code>(Throwable thrown);
<a name="35805"></a> public Throwable <code><b>getException</b></code>();
<a name="35743"></a>}
</pre><a name="35744"></a>
<p><font size=+1><strong>20.23.1 </strong> <code>public <code><b>ExceptionInInitializerError</b></code>()</code></font>
<p>
<a name="35745"></a>
This constructor initializes a newly created <code>ExceptionInInitializerError</code>
with <code>null</code> as its error message string and with a no saved throwable object.
<p><a name="35782"></a>
<p><font size=+1><strong>20.23.2 </strong> <code>public <code><b>ExceptionInInitializerError</b></code>(String s)</code></font>
<p>
<a name="35783"></a>
This constructor initializes a newly created <code>ExceptionInInitializerError</code> by
saving a reference to the error message string <code>s</code> for later retrieval by the <code>getMessage
</code> method <a href="javalang.doc20.html#3275">(§20.22.3)</a>. There is no saved throwable object.
<p><a name="35788"></a>
<p><font size=+1><strong>20.23.3 </strong> <code>public <code><b>ExceptionInInitializerError</b></code>(Throwable thrown)</code></font>
<p>
<a name="35789"></a>
This constructor initializes a newly created <code>ExceptionInInitializerError</code> by
saving a reference to the <code>Throwable</code> object <code>thrown</code> for later retrieval by the
<code>getException</code> method <a href="javalang.doc20.html#3275">(§20.22.3)</a>. The error message string is set to <code>null</code>.
<p><a name="35808"></a>
<p><font size=+1><strong>20.23.4 </strong> <code>public Throwable <code><b>getException</b></code>(Throwable thrown)</code></font>
<p>
<a name="35809"></a>
The saved throwable object of this <code>ExceptionInInitializerError</code> is returned;
<code>null</code> is returned if this <code>ExceptionInInitializerError</code> has no saved throwable
object.
<p><a name="35813"></a>
<p><a name="35806"></a>
<p>
<hr>
<!-- This inserts footnotes--><p>
<a href="index.html">Contents</a> | <a href="javalang.doc20.html">Prev</a> | <a href="javautil.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 © 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 + -