Java OCA OCP Practice Question 2734

Question

Given the following declarations, which of the following statement will compile?

int i = 5;
int j = 10;
  • a. while(i < j) {}
  • b. while(i) {}
  • c. while(i = 5) {}
  • d. while((i = 12)!=5) {}


a and d

Note

The other options will not work because the expression does not evaluate to a Boolean value.




PreviousNext

Related