what will be the output of the following:
for(int a=0;a<10;a++)
if(a==6)
break;
System.out.println(" "+(a++));
pls also explain the cause of the output
Answers
Answered by
3
Answer:
you will get a symbol not found error
Explanation:
you get an error because here you declared the variable a with in the for loop and this will act as local variable and that variable will not have scope out of the loop so we cannot use it outside the loop until we declared it out side the loop.
please let me know if you need more clarification on this feel free to text me
Similar questions