Given:
3. public class Main { 4. static Main base; 5. Main f; /*from w ww. j a v a2 s. c o m*/ 6. public static void main(String[] args) { 7. new Main().go(); 8. // do more stuff 9. } 10. void go() { 11. Main f1 = new Main(); 12. base = f1; 13. Main f2 = new Main(); 14. f1.f = f2; 15. Main f3 = f1.f; 16. f2.f = f1; 17. base = null; f1 = null; f2 = null; 18. // do stuff 19. } }
Which are true? (Choose all that apply.).
C and D are correct.
A total of three Main objects are created.
At line 18, the anonymous (main()
's), Main can still be accessed via "this", and the other two Main objects can be accessed via f3 (f3 and f3.f).
At line 8, none of the three Main objects are accessible.