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 MW[ ] = {21, 56, 31, 459, 52, 742, 26};
boolean some = false;
for(int j = 0; j <MW.length; j++)
{
if (MW[j]/100 > 0)
{
System.out.print("Some Value is :" + MW[j]);
some = true;
break;
}
}
System.out.print(" SOME = " + some);
Very Short Answer
Advertisements
Solution
No Error. Output: Some Value is : 459 SOME = true
shaalaa.com
Is there an error in this question or solution?
Chapter 7: Arrays - One Dimension - Exercises [Page 175]
