Output Questions for Class 10 ICSE Computer Applications

Rewrite the following program segment using if-else statements instead of the ternary operator:

c = (x >= 'A' && x<= 'Z') ? "Upper Case Letter" : "Lower Case Letter";

Java

Java Operators

47 Likes

Answer

if (x >= 'A' && x <= 'Z')
    c = "Upper Case Letter";
else
    c = "Lower Case Letter";

Answered By

31 Likes