The IT Certification Resource Center

Featured Deal

Get CompTIA, Cisco, and Microsoft training courses free for a week.
Learn More ❯

Question 6:

What will be the result of executing the following code?

1.    boolean a = true;
2.    boolean b = false;
3.    boolean c = true;
4.    if (a == true)
5.    if (b == true)
6.    if (c == true)              System.out.println("Some things are true in this world");
7.    else                       System.out.println("Nothing is true in this world!");
8.    else if (a && (b = c))      System.out.println("It's too confusing to tell what is true and what is false");
9.    else                        System.out.println("Hey this won't compile");

A. The code won't compile
B. "Some things are true in this world" will be printed
C. "Hey this won't compile" will be printed
D. None of these