Q.– Given the code fragment:
public static void main(String[] args) {
String[] arr = {{"A", "B", "C"}, {"D", "E"});
for (int i = 0; i < arr.length; i++) {
for (int j = 0; j < arr[i].length; j++) {
System.out.print (arr[i][j] + " ");
if (arr[i][j].equals("B")) {
continue;
}
}
continue;
}
}
What is the result?
A) A B C
B) Compilation fails.
C) A B C D E
D) A B D E
D) A B C E
⧪ please give your answer in a comment section.
public static void main(String[] args) {
String[] arr = {{"A", "B", "C"}, {"D", "E"});
for (int i = 0; i < arr.length; i++) {
for (int j = 0; j < arr[i].length; j++) {
System.out.print (arr[i][j] + " ");
if (arr[i][j].equals("B")) {
continue;
}
}
continue;
}
}
What is the result?
A) A B C
B) Compilation fails.
C) A B C D E
D) A B D E
D) A B C E
⧪ please give your answer in a comment section.
4 Comments
C
ReplyDeleteb
ReplyDeleteB
ReplyDeleteC
ReplyDelete