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

📄 instructions2.doc20.html

📁 Jvm 规范说明。The Java Virtual Machine was designed to support the Java programming language. Some concep
💻 HTML
字号:
<html><head><title>VM Spec  </title></head><body BGCOLOR=#eeeeff text=#000000 LINK=#0000ff VLINK=#000077 ALINK=#ff0000> <a href="VMSpecTOC.doc.html">Contents</a> | <a href="Instructions2.doc19.html">Prev</a> | <a href="Instructions2.doc21.html">Next</a> | <a href="Mnemonics.doc.html">Index</a><hr><br> <a name="checkcast"></a><h2>checkcast</h2><ul><a name="67394"></a><li>If S is an ordinary (non-array) class, then:<ul><a name="67398"></a><li>If T is a class type, then S must be the same class <a href="Concepts.doc.html#20389">(&#167;2.8.1)</a> as T, or a subclass of T.<a name="67402"></a><li>If T is an interface type, then S must implement <a href="Concepts.doc.html#16432">(&#167;2.13)</a> interface T.</ul><a name="67403"></a><li>If S is a class representing the array type SC<code>[]</code>, that is, an array of components of type SC, then:<ul><a name="67407"></a><li>If T is a class type, then T must be <code>Object</code> <a href="Concepts.doc.html#27433">(&#167;2.4.6)</a>.<a name="67408"></a><li>If T is an array type TC<code>[]</code>, that is, an array of components of type TC, then one of the following must be true:<ul><a name="67412"></a><li>TC and SC are the same primitive type <a href="Concepts.doc.html#19511">(&#167;2.4.1)</a>.<a name="67416"></a><li>TC and SC are reference types <a href="Concepts.doc.html#25376">(&#167;2.4.5)</a>, and type SC can be cast to TC by these runtime rules. </ul></ul></ul><a name="67417"></a>S cannot be an interface type, because there are no instances of interfaces, only instances of classes and arrays.<p><a name="checkcast.Linking"></a><b>Linking Exceptions</b><br><a name="140427"></a>During resolution of the <code>CONSTANT_Class</code> constant pool item, any of the exceptions documented in <a href="ConstantPool.doc.html#51579">&#167;5.1</a> can be thrown.<p><a name="checkcast.Runtime"></a><b>Runtime Exception</b><br><a name="67420"></a>Otherwise, if <i>objectref</i><em> </em>cannot be cast to the resolved class, array, or interface type, the <i>checkcast</i> instruction throws a <code>ClassCast</code><code>-Exception</code>.<p><a name="checkcast.Notes"></a><b>Notes</b><br><a name="67421"></a>The <i>checkcast</i> instruction is very similar to the <i>instanceof</i> instruction. It differs in its treatment of <code>null</code>, its behavior when its test fails (<i>checkcast</i> throws an exception, <i>instanceof</i> pushes a result code), and its effect on the operand stack.<p><hr><!-- This inserts footnotes--><p><a href="VMSpecTOC.doc.html">Contents</a> | <a href="Instructions2.doc19.html">Prev</a> | <a href="Instructions2.doc21.html">Next</a> | <a href="Mnemonics.doc.html">Index</a><p><font size=-1>Java Virtual Machine Specification (HTML generated by dkramer on February 25, 1997)<br><i><a href="Copyright.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 + -