Monday, December 12, 2011

Java: Get the class name of any Object

Share at Facebook

Using the getClass() method of any object, you can easily obtain the name of the class of that Object. Below is a simple code snippet to clear the things.

TestClass t = new TestClass();
// output: TestClass

No comments: