String s = new String();
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;
dog instanceof Dog :: True
dalmatian instanceof Dog :: True
dog instanceof Dalmatian :: False
Hope it helps...