No, there is no null safe syntax in Java. You must do it manually. Alternatively, you can create or use a utility program, for example commons-lang:
String line = StringUtils.trimToEmpty(reader.readLine());
This way you get either a value or "" if it is null
Bozho source share