그거/Java
Use of String in Java
뽀기
2011. 5. 2. 18:00
So, when the String can be fully resolved at compile time, the concatenation operator is more
efficient than using a StringBuffer. But when the String cannot be resolved at compile time, the
concatenation operator is less efficient than using a StringBuffer.
String 에 들어갈 문자열이 컴파일 시점에 완전히 결정이 된다면 concatenation 연산이 StringBuffer를 사용하는 것 보다 훨씬 효율적이다.
하지만, 그렇지 못할 경우는 StringBuffer를 사용하는게 더 낫다.
String str = "HI~ " + "Lucky " + "!!!";
이건 컴파일 시점에
String str = "HI~ Lucky !!!";
이렇게 된다는 얘기.
누구나 다~~ 알고 있는 얘기. ㅋㅋ
저렇게 코딩하는 사람은 없다는 얘기! ㅋ