tij0119.html

来自「学习java的经典书籍」· HTML 代码 · 共 43 行

HTML
43
字号
<html><body>

<table width="100%"><tr>
<td>
<a href="http://www.bruceeckel.com/javabook.html">Bruce Eckel's Thinking in Java</a>
</td>
<td align="right">
<a href="tij_c.html">Contents</a> | <a href="tij0118.html">Prev</a> | <a href="tij0120.html">Next</a>
</td>
</tr></table>
<hr>

<H1 ALIGN=LEFT>
11:
Run-time type identification
</H1>
<DIV ALIGN=LEFT><FONT FACE="Calligraph421 BT" SIZE=4 COLOR="Black">The
idea of run-time type identification (RTTI) seems fairly simple at first: it
lets you find the exact type of an object when you have a handle to only the
base type. 
</FONT><P></DIV><DIV ALIGN=LEFT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black">However,
the 
</FONT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black"><I>need</I></FONT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black">
for RTTI uncovers a whole plethora of interesting (and often perplexing) OO
design issues and raises fundamental questions of how you should structure your
programs. 
</FONT><P></DIV><DIV ALIGN=LEFT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black">This
chapter looks at the ways that Java allows you to discover information about
objects and classes at run-time. This takes two forms:
&#8220;traditional&#8221; RTTI, which assumes that you have all the types
available at compile-time and run-time, and the &#8220;reflection&#8221;
mechanism in Java 1.1,<A NAME="Index1353"></A>
which allows you to discover class information solely at run-time. The
&#8220;traditional&#8221; RTTI will be covered first, followed by a discussion
of reflection.
</FONT><a name="_Toc375545405"></a><a name="_Toc408018645"></a><P></DIV>

<div align="right">
<a href="tij_c.html">Contents</a> | <a href="tij0118.html">Prev</a> | <a href="tij0120.html">Next</a>
</div>
</body></html>

⌨️ 快捷键说明

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