| 6. |
Which of the following are true about the Outer program? class OuterInnerStatic { static String s1 = "Java"; static String s2 = "2"; public static void main(String[] args) { Inner inner = new Inner(); } static class Inner { String s1 = "Certification"; String s2 = "Exam"; Inner() { System.out.println(OuterInnerStatic.s1); System.out.println(this.s1); System.out.println(s2); } } }
Please select all the correct answers.
|
| |
A.
|
It leads to a compilation error because Outer.s1 should be referenced as Outer.this.s1. |
| |
B.
|
It leads to a compilation error because Inner is created before an instance of its enclosing scope. |
| |
C.
|
It compiles and executes to display the lines: Java Certification Exam |
| |
D.
|
Since the Inner class is static, it does not require an instance of Outer to be created. |