Java/Language Basics/Ternary operator
Ternary operator Demo
public class ConditionalOp
{
public static void main(String args[])
{
int value = 1;
System.out.println("I have " + value + " hat" + (value == 1 ? "." : "s."));
value++;
System.out.println("I have " + value + " hat" + (value == 1 ? "." : "s."));
}
}