1.

Java Example to check if a string is empty or not

Answer»

To check whether a string is empty or not is an easy TASK since Java comes with a function isEmpty () for this.

Let us see an example:

public CLASS Example {  public STATIC void main(String[] args) {    String s = "";      System.out.println("Is the string empty? "+s.isEmpty());    } }

The output:

Is the string empty? TRUE


Discussion

No Comment Found