Q. What is the output of System.out.println(2 + 3 * 4);?

A
20
B
14
C
11
D
8
Solution:

In Java, multiplication has higher precedence than addition. So, 3 * 4 = 12, then 2 + 12 = 14.

Entri Contact Image

Get Expert Advice for Free: Register for Your Free Consultation Now!