Problem with Classes

What is the result of compiling and executing the code snippet given below?

1. class Outer_Demo {
2. private int num = 175; 
3. public class Inner_Demo {
4. public int getNum() {
5. 
6. return num;
7. }
8. }
9. }
10.
11. public class My_class2 {
12. public static void main(String args[]) {
13. Outer_Demo outer = new Outer_Demo(); 
14. Outer_Demo.Inner_Demo inner = outer.newInner_Demo();
15. System.out.println(inner.getNum());
16. }
17. }
Options
  1. 175
  2. Compilation error at line 14
  3. Compilation error at line 15
  4. Runtime error

Related Posts

Close Bitnami banner
Bitnami