check if string is null or empty java

Java
if(str != null && !str.isEmpty()) { /* do your stuffs here */ }
Source

Also in Java: