how ternary operator works in java