달력

4

« 2024/4 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
2011. 5. 2. 18:00

Use of String in Java 그거/Java2011. 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 !!!";


이렇게 된다는 얘기.
누구나 다~~ 알고 있는 얘기. ㅋㅋ
저렇게 코딩하는 사람은 없다는 얘기! ㅋ

 
:
Posted by 뽀기