What is the result?

Given:
public class DoBreak1 {
public static void main(String[] args) {
String[] table = {“aa”, “bb”, “cc”, “dd”};
for (String ss: table) {

if ( “bb”.equals(ss)) {
continue;
}
System.out.println(ss);
if ( “cc”.equals(ss)) {
break;
}
}
}
}
What is the result?

Given:
public class DoBreak1 {
public static void main(String[] args) {
String[] table = {“aa”, “bb”, “cc”, “dd”};
for (String ss: table) {

if ( “bb”.equals(ss)) {
continue;
}
System.out.println(ss);
if ( “cc”.equals(ss)) {
break;
}
}
}
}
What is the result?

A.
aa
cc

B.
aa
bb
cc

C.
cc
dd

D.
cc

E.
Compilation fails.



Leave a Reply 1

Your email address will not be published. Required fields are marked *