// ways to create class object // Dog class object, imports considered. Wherever possible, use the current class. // If you use any other class name, this innocent-looking code // will cause that class's code to be included in the jar, // loaded and its init code run. Class cDog0 = Dog.class; // Dog class object, fully qualified Class cDog1 = com.mindprod.dogs.Dog.class; // actual class of dog object, not class of dog reference. Class cDog2 = dog.getClass(); // current class. Does not work inside static methods. Class cCurrent = this.getClass(); // current class. Works inside static methods. Unfortunately getClassContent is protected, so you will have to jump through hoops. Class cCurrent = SecurityManager.getClassContext()[0]; // Dog class from class name. Imports ignored. Dog without package. Class cDog3 = Class.forName( "Dog" ); // Dog class from package name. Class cDog4 = Class.forName( "com.mindprod.dogs.Dog" ); // gets String class Class cString = java.lang.String.class; // gets String array class Class cStringArray = String[].class; // gets pseudoclass representing double primitive. Class cdouble0 = double.class; // gets Double wrapper class Class cDouble1 = Double.class; // gets underlying double primitive. Class cdouble2 = Double.TYPE;