[java] isEmpty()
Language/Java

[java] isEmpty()

뉴비뉴 2018. 5. 28.

Java String isEmpty

The java string isEmpty() method checks if this string is empty. It returns true, if length of string is 0 otherwise false.

The isEmpty() method of String class is included in java string since JDK 1.6.


Signature

The signature or syntax of string isEmpty() method is given below:

  1. public boolean isEmpty()  

Returns

true if length is 0 otherwise false.


Since

1.6


Java String isEmpty() method example

  1. public class IsEmptyExample{  
  2. public static void main(String args[]){  
  3. String s1="";  
  4. String s2="javatpoint";  
  5.   
  6. System.out.println(s1.isEmpty());  
  7. System.out.println(s2.isEmpty());  
  8. }}  

Test it Now

true
false


'Language > Java' 카테고리의 다른 글

[script] 함수  (0) 2018.05.22
[script] 조건문  (0) 2018.05.10
[script] 비교 연산자  (0) 2018.05.10
[script] 줄바꿈과 여백  (0) 2018.05.10
[script] 주석  (0) 2018.05.10

댓글

💲 추천 글