/******************************************************************************
 * type of object and instance of object
 ******************************************************************************/
public class typeOf
{
    public static void main (String[] args) 
    {

        String str = "Hello World";

        Class cls = str.getClass();
        System.out.println("The type of the object is: \t" + cls.getName());
        if (str instanceof String) 
            System.out.println("The instance of object is: \t" + "String"); 


        StringBuffer sb = new StringBuffer("Good Morning World");
 
        cls = sb.getClass();
        System.out.println("The type of the object is: \t" + cls.getName());
        if (sb instanceof StringBuffer) 
            System.out.println("The instance of object is: \t" + "StringBuffer"); 
    
    }
}