Computer Applications

Predict the output of the following Java program snippet:


boolean p;
p = ("BLUEJ".length() > "bluej".length()) ? true: false;

Java

Java String Handling

43 Likes

Answer

false

Working

Both "BLUEJ" and "bluej" have the same length 5. So, condition of ternary operator is false and false is assigned to boolean variable p.

Answered By

27 Likes


Related Questions