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
En esta página del sitio puede ver el video en línea How to check whether a String is empty or not using the Java isEmpty() method de Duración hora minuto segunda en buena calidad , que subió el usuario Career & Tech HQ 09 junio 2020, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 768 veces y le gustó 7 a los espectadores. Disfruta viendo!