Suppose an object is called obj , then we get Class of obj by |
Class itsclass = obj.getClass(); // and the name of this class by: |
String name = itsclass.getName(); |
One can also use instanceof in following fashion |
"foo" instanceof String // is evaluated to true but |
mPoint pt = new mPoint(x,y); |
pt instanceof String // is evaluated to false |