Suppose you have a reference variable named thing, youre not sure what type of object it points

Question:

Suppose you have a reference variable named thing, you’re not sure what type of object it points to, and you want your program print out its type. The Object class (and therefore any class!) has another method, getClass, that returns a special object of type Class that contains information about the class of the object calling the getClass method. The Class class has a method called getName which returns the name of the class described by its calling object. Write a statement that prints the name of thing’s class.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: