这个压缩包里的都是超级经典的java例子
源代码在线查看: superclass2.htm
Getting the Superclass of a Class Object (Java Developers Almanac Example)
The Java Developers Almanac 1.4
Order this book from Amazon.
google_ad_client = "pub-6001183370374757";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_channel = "4777242811";
google_ad_type = "text_image";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "6666CC";
google_color_url = "6666CC";
google_color_text = "000000";
//-->
Home
>
List of Packages
>
java.lang
[58 examples]
>
Classes
[11 examples]
e63. Getting the Superclass of a Class Object
Class cls = java.lang.String.class;
Class sup = cls.getSuperclass(); // java.lang.Object
cls = java.lang.Object.class;
sup = cls.getSuperclass(); // null
// The superclass of interfaces is always null
cls = java.lang.Cloneable.class;
sup = cls.getSuperclass(); // null
// The superclass of primitive types is always null
cls = int.class;
sup = cls.getSuperclass(); // null
Related Examples
e59.
Getting a Class Object
e60.
Getting the Name of a Class Object
e61.
Determining If a Class Object Represents a Class or Interface
e62.
Getting the Superclass of an Object
e64.
Listing the Interfaces That a Class Implements
e65.
Listing the Interfaces That an Interface Extends
e66.
Getting the Package of a Class
e67.
Determining from Where a Class Was Loaded
e68.
Loading a Class That Is Not on the Classpath
e69.
Dynamically Reloading a Modified Class
See also:
Arrays
Assertions
Commands
Numbers
Objects
Strings
System Properties
Threads
© 2002 Addison-Wesley.