Java getClass() Method
Chapter:
Miscellaneous
Last Updated:
15-10-2016 18:41:24 UTC
Program:
/* ............... START ............... */
class Test {
}
public class JavaGetClassMethod {
public static void main(String[] args) {
Test testRef = new Test();
Class testClass = testRef.getClass();
}
}
/* ............... END ............... */
Notes:
-
The Object class has a getClass() method, which returns the reference to the Class object of the class of the object.
Tags
Java getClass() Method,Java