public class Question { public static void main(String[] args) { Boolean b = new Boolean(“TRUE”); if (b) { for (Integer i = 0; i < 10; i++) { System.out.println(i); } } } } Đoạn mã sau sai chỗ nào?

public class Question {

public static void main(String[] args) {

Boolean b = new Boolean(“TRUE”);

if (b) {

for (Integer i = 0; i < 10; i++) {

System.out.println(i);

}

}

}

}

Đoạn mã sau sai chỗ nào?

A. (1) Đoạn mã không có lỗi

B. (2) Điều kiện của câu lệnh if phải có kiểu boolean thay vì Boolean

C. (3) Chỉ số của câu lệnh for là int thay vì Integer

D. Câu (2) và (3) đúng

Hướng dẫn

Chọn D là đáp án đúng

 

Thư viện tài liệu12 Tháng bảy, 2023 @ 2:31 chiều

Đánh giá chủ đề này
How to whitelist website on AdBlocker?

How to whitelist website on AdBlocker?

  1. 1 Click on the AdBlock Plus icon on the top right corner of your browser
  2. 2 Click on "Enabled on this site" from the AdBlock Plus option
  3. 3 Refresh the page and start browsing the site