Determining and Testing Class of Object
Suppose we have an object called obj. We get the class of obj by:
- Class class = obj.getClass();
and its name by:
- String name = class.getName();
One can also use instanceof in following fashion:
evaluates to true, but
- ( new mPoint(x,y) ) instanceof String