Câu 29: GSSP-Java: GIAC Secure Software Programmer-Java
Sam works as a Software Developer for Gentech Inc. He writes the following code.1. class TryFinallyTest {2. public static void main(String[] args) {3. try {4. int i=15/0;5. System.out.println("Testing Try");6. }7. catch(ArithmeticException ae) {8. System.out.println("Arithmetic exception");9. }10. System.out.println("…
Nội dung câu hỏi
Sam works as a Software Developer for Gentech Inc. He writes the following code.1. class TryFinallyTest {2. public static void main(String[] args) {3. try {4. int i=15/0;5. System.out.println("Testing Try");6. }7. catch(ArithmeticException ae) {8. System.out.println("Arithmetic exception");9. }10. System.out.println("Correct");11. finally {12. System.out.println("Must execute");13. }14. }15. }What will happen when he attempts to compile and execute the code?
Các lựa chọn
Đáp án được giữ gọn theo nhãn A, B, C, D trong phần bình chọn tương tác.
- A. It will compile successfully and run with output Arithmetic exception.
- B. It will compile successfully and run with output Must execute.
- C. It will compile successfully and run with output Correct.
- D. It will give a compile-time error. — đáp án hiện tại
Cộng đồng
0 bình luận công khai. Tên thành viên được ẩn một phần.