728x90

빈값확인 및 null확인

 

String a = "";
String b = null;

1. a의 경우

System.out.println(a.isEmpty());
  • 결과값 : true

2. b의 경우

System.out.println(b == null);
  • 결과값 : true

+ Recent posts