Java OCA OCP Practice Question 2379

Question

What is the output of the following code?

int a = 10; 
int b = 20; 
int c = (a * (b + 2)) - 10-4 * ((2*2) - 6; 
System.out.println(c); 
  • a 218
  • b 232
  • c 246
  • d Compilation error


d

Note

First of all, whenever you answer any question that uses parentheses to override operator precedence, check whether the number of opening parentheses matches the number of closing parentheses.

This code won't compile because the number of opening parentheses doesn't match the number of closing parentheses.




PreviousNext

Related