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