img
public static void main(String args[]) {
X x = new X();
Y y = new Y();
Class<?> clObj;
clObj = x.getClass(); // get Class reference
System.out.println("x is object of type: " +
clObj.getName());
clObj = y.getClass(); // get Class reference
System.out.println("y is object of type: " +
clObj.getName());
clObj = clObj.getSuperclass();
System.out.println("y's superclass is " +
clObj.getName());
}
}
The output from this program is shown here:
x is object of type: X
y is object of type: Y
y's superclass is X
ClassLoader
The abstract class ClassLoader defines how classes are loaded. Your application can create
subclasses that extend ClassLoader, implementing its methods. Doing so allows you to load
classes in some way other than the way they are normally loaded by the Java run-time system.
However, this is not something that you will normally need to do.
Math
The Math class contains all the floating-point functions that are used for geometry and
trigonometry, as well as several general-purpose methods. Math defines two double
constants: E (approximately 2.72) and PI (approximately 3.14).
Transcendental Functions
The following methods accept a double parameter for an angle in radians and return the
result of their respective transcendental function:
Method
Description
static double sin(double arg)
Returns the sine of the angle specified by arg in radians.
static double cos(double arg)
Returns the cosine of the angle specified by arg in radians.
static double tan(double arg)
Returns the tangent of the angle specified by arg in radians.
Search WWH :
Custom Search
Previous Page
Java SE 6 Topic Index
Next Page
Java SE 6 Bookmarks
Home