Câu 10: GSSP-Java: GIAC Secure Software Programmer-Java
Dennis works as a Programmer in Broadnet Inc. He writes the following program.1. public class Ques0307{2. public static void main(String[] argv){3. int arr[] = {1, 2, 3, 4};4. try{5. int k = 0;6. for(; k < 4; k++)7. arr[k] = arr[k] + 1;8. System.out.println("try");9. }10. catch(ArrayIndexOutOfBoundsException a){11. Sy…
Nội dung câu hỏi
Dennis works as a Programmer in Broadnet Inc. He writes the following program.1. public class Ques0307{2. public static void main(String[] argv){3. int arr[] = {1, 2, 3, 4};4. try{5. int k = 0;6. for(; k < 4; k++)7. arr[k] = arr[k] + 1;8. System.out.println("try");9. }10. catch(ArrayIndexOutOfBoundsException a){11. System.out.println("index " +k +" not found");12. }13. catch(Exception e){14. System.out.println("catch1");15. }16. finally{17. System.out.println("finally");18. }19. }20. }What will happen when Dennis attempts to compile and execute the program?
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. A compile-time error will occur. — đáp án hiện tại
- B. The program will display index 0 not found catch1 finally
- C. The program will display index 4 not found finally
- D. The program will display try finally
Cộng đồng
0 bình luận công khai. Tên thành viên được ẩn một phần.