본문으로 바로가기

연산자

category 카테고리 없음 2021. 3. 24. 06:33
  • 문자열을 결합할 때도 + 연산자를 사용
String first = "This is";
String second = "a chicken.";

String third = first + second;

System.out.println(third); // This is a chicken.

 

  • equals( ) : 문자열 비교
String a = "Hello world";
String b = new String("Hello world");

System.out.println(a==b); // False
System.out.println(a.equlas(b)); // True