Oracle
1Z0-803 · Question #258
Given the code fragment: System.out.println(2 + 4 9 - 3); //Line 21 System.out.println((2 + 4) 9 - 3); // Line 22 System.out.println(2 + (4 9) - 3); // Line 23 System.out.println(2 + 4 (9 - 3)); // Li
The correct answer is B. Line 22. The following is printed:
Using Operators and Decision Constructs
Question
Given the code fragment:
System.out.println(2 + 4 * 9 - 3); //Line 21 System.out.println((2 + 4) * 9 - 3); // Line 22 System.out.println(2 + (4 * 9) - 3); // Line 23 System.out.println(2 + 4 * (9 - 3)); // Line 24 System.out.println((2 + 4 * 9) - 3); // Line 25 Which line of codes prints the highest number?
Options
- ALine 21
- BLine 22
- CLine 23
- DLine 24
- ELine 25
How the community answered
(28 responses)- B93% (26)
- C4% (1)
- E4% (1)
Explanation
The following is printed:
Topics
#operators#operator precedence#arithmetic operations#parentheses
Community Discussion
No community discussion yet for this question.