|
|
|
|
There exists a class in Java called -- appropriately, but perhaps confusingly -- Class. This class maintains run-time type information about the components of your program while it is running. Class Class does not have a public constructor. Instead, you obtain an instance of this class in one of a number of ways. For example, by using:
String s; ... Class c = s.getClass();
Class c1 = String.class; Class c2 = int.class; Class c3 = Double[].class; Class has many useful methods you can use to obtain information about the element it describes. For example, assume we have the following classes and interfaces:
|
| The page was last updated February 19, 2008 |