What Is The Output Of The Following Java Codep Pre Langjava #650
What is the output of the following Java code?</p> <pre><code class="language-java"> public class StaticFinalClass { static final class Final { Integer i = new Integer(6124); void ClassCheck() { System.out.println(i.getClass()); System.out.println(i.getClass().getSuperclass()); } } public static void main(String[] args) { StaticFinalClass.Final i = new StaticFinalClass.Final(); i.ClassCheck(); } }</code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs111 OOP Object Oriented Programming Java. It can also be found in gs gs111 Types of Classes (Using Java) - Final Class - Quiz No.1.
What is the output of the following Java code?
public class StaticFinalClass { static final class Final { Integer i = new Integer(6124); void ClassCheck() { System.out.println(i.getClass()); System.out.println(i.getClass().getSuperclass()); } } public static void main(String[] args) { StaticFinalClass.Final i = new StaticFinalClass.Final(); i.ClassCheck(); } }
Compilation Error
class java.io.Integer class java.io.Object
class java.io.Integer class java.io.Number
class java.lang.Integer class java.lang.Number