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

📄 javalang.doc3.html

📁 java语言规范
💻 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.doc2.html">Prev</a> | <a href="javalang.doc4.html">Next</a> | <a href="j.index.doc1.html">Index</a>
<hr><br>
 
<a name="14344"></a>
<center><h1>20.4  The Class  <code>java.lang.Boolean</code></h1></center>
<a name="2138"></a>
Objects of type <code>Boolean</code> represent primitive values of type <code>boolean</code>.
<p><pre><a name="13812"></a>public final class <code><b>Boolean</b></code> {
<a name="3330"></a>	public static final Boolean <code><b>TRUE</b></code> = new Boolean(true);
<a name="1888"></a>	public static final Boolean <code><b>FALSE</b></code> = new Boolean(false);
<a name="1890"></a>	public <code><b>Boolean</b></code>(boolean value);
<a name="1892"></a>	public <code><b>Boolean</b></code>(String s);
<a name="1896"></a>	public String <code><b>toString</b></code>();
<a name="1897"></a>	public boolean <code><b>equals</b></code>(Object obj);
<a name="1902"></a>	public int <code><b>hashCode</b></code>();
<a name="1905"></a>	public boolean <code><b>booleanValue</b></code>();
<a name="1983"></a>	public static Boolean <code><b>valueOf</b></code>(String s);
<a name="1984"></a>	public static boolean <code><b>getBoolean</b></code>(String name);
<a name="1988"></a>}
</pre><a name="1985"></a>
<p><font size=+1><strong>20.4.1   </strong> <code>public static final Boolean <code><b>TRUE</b></code> = new Boolean(true);</code></font>
<p>
<a name="1964"></a>
The constant value of this field is a <code>Boolean</code> object corresponding to the primitive 
value <code>true</code>.
<p><a name="1968"></a>
<p><font size=+1><strong>20.4.2   </strong> <code>public static final Boolean <code><b>FALSE</b></code> = new Boolean(false);</code></font>
<p>
<a name="1969"></a>
The constant value of this field is a <code>Boolean</code> object corresponding to the primitive 
value <code>false</code>.
<p><a name="1970"></a>
<p><font size=+1><strong>20.4.3   </strong> <code>public <code><b>Boolean</b></code>(boolean value)</code></font>
<p>
<a name="1971"></a>
This constructor initializes a newly created <code>Boolean</code> object so that it represents 
the primitive value that is the argument.
<p><a name="1972"></a>
<p><font size=+1><strong>20.4.4   </strong> <code>public <code><b>Boolean</b></code>(String s)</code></font>
<p>
<a name="1973"></a>
This constructor initializes a newly created <code>Boolean</code> object so that it represents 
<code>true</code> if and only if the argument is not <code>null</code> and is equal, ignoring case, to the 
string <code>"true"</code>.
<p><a name="33801"></a>
Examples:<p>
<pre><a name="1974"></a>
<code>new</code> <code>Boolean("True")</code> produces a <code>Boolean</code> object that represents <code>true</code>.
<a name="1975"></a><code>new</code> <code>Boolean("yes")</code> produces a <code>Boolean</code> object that represents <code>false</code>.
</pre><a name="4068"></a>
<p><font size=+1><strong>20.4.5   </strong> <code>public String <code><b>toString</b></code>()</code></font>
<p>
<a name="4076"></a>
If this <code>Boolean</code> object represents <code>true</code>, a string equal to <code>"true"</code> is returned. If 
this <code>Boolean</code> object represents <code>false</code>, a string equal to <code>"false"</code> is returned.
<p><a name="4077"></a>
Overrides the <code>toString</code> method of <code>Object</code> <a href="javalang.doc1.html#1152">(&#167;20.1.2)</a>.<p>
<a name="1978"></a>
<p><font size=+1><strong>20.4.6   </strong> <code>public boolean <code><b>equals</b></code>(Object obj)</code></font>
<p>
<a name="1979"></a>
The result is <code>true</code> if and only if the argument is not <code>null</code> and is a <code>Boolean</code> object 
that represents the same <code>boolean</code> value as this <code>Boolean</code> object.
<p><a name="4016"></a>
Overrides the <code>equals</code> method of <code>Object</code> <a href="javalang.doc1.html#14865">(&#167;20.1.3)</a>.<p>
<a name="1957"></a>
<p><font size=+1><strong>20.4.7   </strong> <code>public int <code><b>hashCode</b></code>()</code></font>
<p>
<a name="1958"></a>
If this <code>Boolean</code> object represents <code>true</code>, the integer <code>1231</code> is returned. If this 
<code>Boolean</code> &#32;object represents <code>false</code>, the integer <code>1237</code> is returned.
<p><a name="4023"></a>
Overrides the <code>hashCode</code> method of <code>Object</code> <a href="javalang.doc1.html#13784">(&#167;20.1.4)</a>.<p>
<a name="52449"></a>
<p><font size=+1><strong>20.4.8   </strong> <code>public boolean <code><b>booleanValue</b></code>()</code></font>
<p>
<a name="52450"></a>
The primitive <code>boolean</code> value represented by this <code>Boolean</code> object is returned.
<p><a name="15210"></a>
<p><font size=+1><strong>20.4.9   </strong> <code>public static boolean <code><b>valueOf</b></code>(String s)</code></font>
<p>
<a name="15252"></a>
The result is <code>true</code> if and only if the argument is not <code>null</code> and is equal, ignoring 
case, to the string <code>"true"</code>.
<p><a name="15253"></a>
Example: <code>Boolean.valueOf("True")</code> returns <code>true</code>.<p>
<a name="15254"></a>
Example: <code>Boolean.valueOf("yes")</code> returns <code>false</code>.<p>
<a name="13824"></a>
<p><font size=+1><strong>20.4.10   </strong> <code>public static boolean <code><b>getBoolean</b></code>(String name)</code></font>
<p>
<a name="15267"></a>
The result is <code>true</code> if and only if the value of the system property (&#167;20.18.9)</a> named 
by the argument is equal, ignoring case, to the string <code>"true"</code>.<img src="javalang.doc.anc46.gif">
<p>

<hr>
<!-- This inserts footnotes--><p>
<a href="index.html">Contents</a> | <a href="javalang.doc2.html">Prev</a> | <a href="javalang.doc4.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 + -