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

📄 tij0086.html

📁 学习java的经典书籍
💻 HTML
字号:
<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="tij0085.html">Prev</a> | <a href="tij0087.html">Next</a>
</td>
</tr></table>
<hr>

<H1 ALIGN=LEFT>
8:
Holding 
<P>your
objects
<a name="OLE_LINK2"></a></H1>
<DIV ALIGN=LEFT><FONT FACE="Calligraph421 BT" SIZE=4 COLOR="Black">It&#8217;s
a fairly simple program that has only a fixed quantity of objects with known
lifetimes.
</FONT><P></DIV><DIV ALIGN=LEFT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black">In
general, your programs will always be creating new objects based on some
criteria that will be known only at the time the program is running. You
won&#8217;t know until run-time the quantity or even the exact type of the
objects you need. To solve the general programming problem, you need to create
any number of objects, anytime, anywhere. So you can&#8217;t rely on creating a
named handle to hold each one of your objects:
</FONT><P></DIV><DIV ALIGN=LEFT><TT><FONT FACE="Courier New" SIZE=3 COLOR="Black">MyObject
myHandle;
</FONT></TT><P></DIV><DIV ALIGN=LEFT><P></DIV><DIV ALIGN=LEFT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black">since
you&#8217;ll never know how many of these things you&#8217;ll actually need.
</FONT><P></DIV><DIV ALIGN=LEFT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black">To
solve this rather essential problem, Java has several ways to hold objects (or
rather, handles to objects). The built-in type is the array, which has been
discussed before and will get additional coverage in this chapter. Also, the
Java utilities library has some <A NAME="Index716"></A></FONT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black"><I>collection
classes
</I></FONT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black">
(also known as <A NAME="Index717"></A></FONT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black"><I>container
classes
</I></FONT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black">,
but that term is used by the AWT so &#8220;collection&#8221; will be used here)
that provide more sophisticated ways to hold and even manipulate your objects.
This will comprise the remainder of this chapter.
</FONT><a name="_Toc375545347"></a><a name="_Toc408018563"></a><P></DIV>

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

⌨️ 快捷键说明

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