How to check whether a String is empty or not using the Java isEmpty() method

Publicado em: 09 Junho 2020
no canal de: Career & Tech HQ
768
7

How to check whether a String is empty or not using the Java isEmpty() method

In this video, we will talk about the Java isEmpty() method, which is used to check whether a String is empty or not. This method returns a Boolean value. True if the given String is empty that is to say if the length of the String is 0. And it returns false if the given String is not empty.
Let’s take an example to see how this method works

String str1 = “ ”;
String str2 = “”;

System.out.println(str1.isEmpty());
This will program will return false, because as you know, the white space is considered as a character. So, str1 is not empty.

System.out.println(str2.isEmpty());
This statement will return true, str2 is indeed empty

#codingriver
#java
#programming


Nesta página do site você pode assistir ao vídeo on-line How to check whether a String is empty or not using the Java isEmpty() method duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Career & Tech HQ 09 Junho 2020, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 768 vezes e gostou 7 espectadores. Boa visualização!