Java Reference
In-Depth Information
27. What gets printed in the following program? (Select four answers.)
1. public class Mouse {
2. public String name;
3.
4. public void run() {
5. System.out.print(“1”);
6. try {
7. System.out.print(“2”);
8. name.toString();
9. System.out.print(“3”);
10. }catch(NullPointerException e) {
11. System.out.print(“4”);
12. throw e;
13. }
14. System.out.print(“5”);
15. }
16.
17. public static void main(String [] args) {
18. Mouse jerry = new Mouse();
19. jerry.run();
20. System.out.print(“6”);
21. }
22. }
A. 1
B. 2
C. 3
D. 4
E. 5
F. 6
G. Stack trace for a NullPointerException
Search WWH ::




Custom Search