Advertisements
Advertisements
Question
Some of the code given below contains errors. Identify the error and correct it. Write the output of the correct/corrected code.
int YM[] = { 512, 312, 452, 652, 782};
boolean all = true;
for(int j = 0; j <5; j++)
{
if(YM[j]%10 !=2)
{
all = false;
}
}
System.out.print(" ALL =" + all);
Very Short Answer
Advertisements
Solution
No Error. Output : ALL = true
shaalaa.com
Is there an error in this question or solution?
Chapter 7: Arrays - One Dimension - Exercises [Page 175]
