Java OCA OCP Practice Question 2724

Question

Given the following declarations, which of the following if statements will compile without errors?

int i = 3;
int j = 3;
int k = 3;
  • a. if(i > j) {}
  • b. if(i > j > k) {}
  • c. if(i > j && i > k) {}
  • d. if(i > j && > k) {}


a and c

Note

Option b results in a comparison between i and j which returns a Boolean value.

This value cannot be compared against the integer k.

Option d requires an operand before the expression, >k.




PreviousNext

Related