Boolean If Else With Not Operator
What is printed as a result of executing the following code segment?
public class Main {
public static void main(String[] args) {
boolean flag = true;
if(!flag)
System.out.println("False branch");
else
System.out.println("True branch");
}
}
A
No output
B
True branch
C
Runtime Error
D
False branch
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | bommasam000 | 3 | 3 | 3m 01s | 119 |
| #2 | hadleysmith5 | 1 | 1 | 0m 00s | 100 |
| #3 | kazvin.tjakradinata | 1 | 1 | 0m 05s | 95 |
| #4 | chunxiangxu.cxu | 1 | 1 | 0m 09s | 91 |
| #5 | hitrishabhatia | 1 | 2 | 0m 00s | 90 |
| #6 | y.seong2027 | 1 | 1 | 0m 15s | 85 |
| #7 | suhanakochhar006 | 1 | 1 | 0m 48s | 52 |
| #8 | mahmoudjibrin08 | 0 | 1 | 0m 00s | -10 |
| #9 | namansoin000 | 0 | 1 | 0m 19s | -29 |
Items per page:
10
1 – 9 of 9
APFIVE