200+ câu trắc nghiệm Lập trình Java cơ sở có đáp án - Phần 5

Chương trình sau ra kết quả là gì?javaclass ContinueDemo {public static void main(String[] args) {String searchMe = "peter piper picked a peck of pickled peppers";int max = searchMe.length();

3/30

Chương trình sau ra kết quả là gì?

class ContinueDemo {

public static void main(String[] args) {

String searchMe = "peter piper picked a peck of pickled peppers";

int max = searchMe.length();

int numPs = 0;

for (int i = 0; i < max; i++) {

if (searchMe.charAt(i) != 'p')

continue;

numPs++;

}

System.out.println("Found " + numPs + " p's in the string.");

}

}

</>

Found 9 p's in the string.

Found 8 p's in the string.

Found 10 p's in the string.

Không có đáp án đúng.

Giải thích

Chọn đáp án A