Question: Consider the following Java code: public class MyClass { public static void main(String[] args) { int i = 10; Object obj = (Object) i; System.out.println(obj.getClass());

Consider the following Java code:

public class MyClass {

public static void main(String[] args) {

int i = 10;

Object obj = (Object) i;

System.out.println(obj.getClass());

}

}


What is the output of the program when it is run with java MyClass command using Java 8 or later?

A. class java.lang.Integer

B. class java.lang.Object

C. class java.lang.String

D. class java.lang.Boolean

E. Compilation error


Step by Step Solution

3.34 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The detailed answer for the above question is provided below This question tests yo... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!