java ternary operator check string equals code example Example: java ternary operator Object myObject = booleanExpression ? valueIfTrue : valueIfFalse;