GetClass() method in Object Class :
String s = new String();
System.out.printl />
Returns the runtime class of an object. Here object is 's' and its type is String so it returns String
------
instanceof is a keyword.
It checks an object reference if that defined by a class or its subclasses and returns a boolean value;
The instanceof Object will return true for all object references, since all Java objects are inherited from Object. Note, that instanceof will always return false if is null.
Syntax:
instanceof ClassName
eg
dog instanceof Dog :: True
dalmatian instanceof Dog :: True
dog instanceof Dalmatian :: False
Hope it helps...
String s = new String();
System.out.printl />
Returns the runtime class of an object. Here object is 's' and its type is String so it returns String
------
instanceof is a keyword.
It checks an object reference if that defined by a class or its subclasses and returns a boolean value;
The
Syntax:
eg
dog instanceof Dog :: True
dalmatian instanceof Dog :: True
dog instanceof Dalmatian :: False
Hope it helps...