1 | Suppose we have an object called obj. We get the class of obj by: |
2 | Class class = obj.getClass(); |
3 | and its name by: |
4 | String name = class.getName(); |
5 | One can also use instanceof in following fashion: |
6 | "foo" instanceof String |
7 | evaluates to true, but |
8 | ( new mPoint(x,y) ) instanceof String |
9 | evaluates to false. |