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
The detailed answer for the above question is provided below This question tests yo... View full answer
Get step-by-step solutions from verified subject matter experts
