What is the result? Given: What is the result? Given: What is the result? A. 1 2 3 B. The loop executes infinite times C. 2 3 4 D. 1 1 1 E. Compilation fails Show Hint ← Previous question Next question →
xxx public class Access { public static void main(String[] args){ int arr[] = {1,2,3}; for(int var:arr){ int i =1; while(i<=var); System.out.println(i++); } } } b Reply
int arr[]={1,2,3};
for(int var:arr){
int i=1;
while(i B
public class Access {
public static void main(String[] args){
int arr[] = {1,2,3};
for(int var:arr){
int i =1;
while(i<=var);
System.out.println(i++);
}
}
}
b
the reason is the semicolon after the while statement