15.1.html
来自「翁剀JAVA语言那门课程的教案 很多人都看多他的视频教程可惜没有ppt的教案」· HTML 代码 · 共 33 行
HTML
33 行
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Author" CONTENT="Weng Kai">
<TITLE>Class object</TITLE>
</HEAD>
<BODY>
<H1>15.1 Class object</H1>
<HR WIDTH="100%">
The Class object is used to create all of the "regular" objects of your class.
<p>
Each time you write a new class, a single Class object is also created (and stored, appropriately enough, in an identically named .class file). At run time, when you want to make an object of that class, the Java Virtual Machine (JVM) that's executing your program first checks to see if the Class object for that type is loaded. If not, the JVM loads it by finding the .class file with that name.
<p>
Case Study: <a href=case/SweetShop.java>SweetShop.java</a>
<p>
The output of this program for one JVM is:
<pre>
inside main
Loading Candy
After creating Candy
Loading Gum
After Class.forName("Gum")
Loading Cookie
After creating Cookie
</pre>
<p>
In Java 1.1 you have a second way to produce the handle to the Class object: use the class literal. In the above program this would look like:
<pre>Gum.class;</pre>
<HR WIDTH="100%">
<DIV ALIGN=right><A HREF="15.2.html">Next Page</A></DIV>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?