Author: Sudhakar Nagarajan
Exam Permalink:
https://www.jobilize.com/java-certification-questions
Question Permalink:
https://www.jobilize.com/sudhakar-nagarajan-what-will-be-the-output-public-class-innerclassthis-int-x-10-public-void
Question 295 / 297:  What will be the Output?
public class InnerClassThis {

int x=10;

public void foo() {

System.out.println("Outer class");

}

public class ReallyInner {

public void foo() {

System.out.println("Inner class");

}

public void test() {

this.foo();

InnerClassThis.this.foo();

}

}

public static void main(String... args) {

InnerClassThis.ReallyInner i = new InnerClassThis().new ReallyInner();

i.test();

}

}

A  The code does not compile.
B  Inner class Outer class
C  The code compiles but throws runtime exception
D  Outer class Inner class
<< First < Previous Next > Last >>
Exam Home Page
https://www.jobilize.com/java-certification-questions

Oracle Certified Professional Java Programmer

Author:

Access: Public Instant Grading

Ask
Keyaira Braxton
Start Exam
Copy and paste the following HTML code into your website or blog.
<iframe src="https://www.jobilize.com/embed/java-certification-questions" width="600" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" style="border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>