int i = 0; while (true) { if(i==4) { break; } ++i; } System.out.println(“i=”+i); What is the result?()
A. i = 0 B. i = 3 C. i = 4 D. i = 5 E. Compilation fails.
1. public class Exception Test { 2. class TestException extends Exception {} 3. public void runTest() throws TestException {} 4. public void test() /* Point X */ { 5. runTest(); 6. } 7. } At Point X on line 4, which code is necessary to make the code compile?()
A. No code is necessary. B. throws Exception C. catch ( Exception e ) D. throws RuntimeException E. catch ( TestException e)
12. void start() { 13. A a = new A(); 14. B b = new B(); 15. a.s(b); 16. b = null; 17. a = null; 18. System.out.println(“start completed”); 19. } When is the B object, created in line 14, eligible for garbage collection?()
A. After line 16. B. After line 17. C. After line 18 (when the methods ends). D. There is no way to be absolutely certain. E. The object is NOT eligible for garbage collection.