To check if a string is null or empty in Java, use the == operator . Let’s say we have the following strings. String myStr1 = “Jack Sparrow”; String myStr2 = “”; Let us check both the strings now whether they are null or empty.6 Ara 2018
Read moreIs empty string == null?
An empty string is a string instance of zero length, whereas a null string has no value at all. An empty string is represented as “” . It is a character sequence of zero characters. A null string is represented by null .
Read more