Question
int x = l, y = 6;
while (y--)
{
x++;
}
System.out.println("x = " + x +" y = " + y);
What will be the output of the program?
int x = l, y = 6;
while (y--)
{
x++;
}
System.out.println("x = " + x +" y = " + y);
Answer: Option D
Was this answer helpful ?
Compilation fails because the while loop demands a boolean argument for it's looping
condition, but in the code, it's given an int argument.
while(true) { //insert code here }
Was this answer helpful ?
More Questions on This Topic :
Question 10.
public class While
{
public void loop()
{
....
Submit Solution