java 11 check if string is not null code example Example: check if string is null or empty java if(str != null && !str.isEmpty()) { /* do your stuffs here */ }