?
Determine output:
Determine output:
public class Test{
public static void main(String args[]){
int i, j;
for(i=1, j=0;i<10;i++) j += i;
System.out.println(i);
}
}
public class Test{
public static void main(String args[]){
int i, j;
for(i=1, j=0;i<10;i++) j += i;
System.out.println(i);
}
}
Answer & Solution
Correct Answer:
Option
A
In giving a program for loop will be break when i=10. Since after for only one statement execute ( j += i;) because brace is not mentioned and after that print statement will execute and print i=10
Join the Discussion
Login to post a comment or share your explanation.
Login