ternary operator in java for null check code example Example: ternary operator in java for null check String value = object != null ? object.getValue() : null;