Home » JAVA Programming » Object & Classes » Question
  1. What is the output of this program?

    public class Result
    {
    public static void main(String args[])
    {
    Object object = new Object();
    System.out.print(object.getclass());
    }
    }
    1. Compilation error
    2. class object
    3. class java.lang.Object
    4. Runtime error
    5. None of these
Correct Option: A

Result.java:6: error: cannot find symbol
System.out.print(object.getclass());
^
symbol: method getclass()
location: variable object of type Object
1 error
output: Compilation error



Your comments will be displayed only after manual approval.