Which is valid Java syntax for an if-statement?
- A
if x > 0: { ... }
- Bcheck_circle
if (x > 0) { ... }
- C
if (x > 0) then { ... }
- D
if x > 0 { ... }
Explanation
Java requires parentheses around the condition.
AP Computer Science A· difficulty 1/5
Which is valid Java syntax for an if-statement?
if x > 0: { ... }
if (x > 0) { ... }
if (x > 0) then { ... }
if x > 0 { ... }
Explanation
Java requires parentheses around the condition.
Want 10 more like this — adaptive to your weak spots?