Java Reference
In-Depth Information
A. 0
B. 16
C. 34
D. 35
E. The code does not compile.
22. What is the output of the following program?
1. public class Laptop {
2. public void start() {
3. try {
4. System.out.print(“Starting up”);
5. throw new Exception();
6. }catch(Exception e) {
7. System.out.print(“Problem”);
8. System.exit(0);
9. }finally {
10. System.out.print(“Shutting down”);
11. }
12. }
13.
14. public static void main(String [] args) {
15. new Laptop().start();
16. }
17. }
A. Starting up
B. Starting upProblem
C. Starting upProblemShutting down
D. Starting upShutting down
E. The code does not compile.
23. What is the output of the following program?
1. public class Dog {
2. public String name;
3.
4. public void parseName() {
5. System.out.print(“1”);
6. try {
7. System.out.print(“2”);
8. int x = Integer.parseInt(name);
9. System.out.print(“3”);
Search WWH ::




Custom Search