1, instanceof and getclass (). GetName (). COMPARETO () Differences and Contact
<1> InstanceOf is the keyword is in the JVM; it is used to determine if an instance belongs to a certain class or his parent class;
<2> getClass (). Getnname () returned to the true class name, so when it is compared to the parent class of the class;
EG.
String TT = New String ("");
IF (tt.getclass (). getname (). Compareto ("java.lang.string") == 0) // RTURN TRUE;
IF (tt.getclass (). getname (). Compareto ("java.lang.object") == 0) // Return False;
IF (TT InstanceOf String) // Return True;
IF (TT InstanceOf Object) // Return False;