The IT Certification Resource Center

Featured Deal

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

Question 4:

What results from attempting to compile and run the following code?

public class Ternary
{
    public static void main(String args[])
    {
        int a = 5;
        System.out.println("Value is - " + ((a < 5) ? 9.9 : 9));
    }
}

A. prints: Value is - 7
B. prints: Value is - 5
C. Compilation error
D. None of these