Given the code fragment: What is the result?
A.
20
B.
25
C.
29
D.
Compilation fails
E.
AnArrayIndexOutOfBoundsException is thrown at runtime
Given the code fragment: What is the result?
Given the code fragment: What is the result?
A.
20
B.
25
C.
29
D.
Compilation fails
E.
AnArrayIndexOutOfBoundsException is thrown at runtime
Image link is dead.
public static void main(String[] args) {
int num=5;
int sum;
do{
sum+=num;
}while ((num–)>1);
System.out.println(“The sum is “+ sum +”.”);
}
d
Compilation fails. Variable sum might not hav been initialized