Given:
2. public class Main { 3. private int y = 8; 4. public static void main(String[] args) { 5. new Main().go(); 6. } //from ww w .j a va 2s.c om 7. void go() { 8. int x = 7; 9. MyInner ip = new MyInner(); 10. class MyInner { 11. void doit() { System.out.println(y + x); } 12. } 13. ip.doit(); 14. } 15. }
What is the result? (Choose all that apply.)
D and F are correct.
Method-local inner classes can use variables from their enclosing methods, only if they are marked "final".
A method-local inner class can be instantiated only after it has been declared.
It is legal to use private members from the enclosing class.