instance of meaning code example
Example 1: instance of
The instanceof keyword checks whether an object
is an instance of a specific class or an interface.
The instanceof keyword compares the
instance with type. The return value
is either true or false .
Example 2: instance of
if (cobj instanceof Child)
System.out.println("cobj is instance of Child");
else
System.out.println("cobj is NOT instance of Child");
// Source: https://www.geeksforgeeks.org/java-instanceof-and-its-applications/