| Author |
String
|
John Mathew
Greenhorn
Joined: Apr 17, 2007
Posts: 13
|
|
The statement ... String s = "Hello" + "Java"; yields the same value for s as ... String s = "Hello"; String s2= "Java"; s.concat( s2 );
|
 |
Vassili Vladimir
Ranch Hand
Joined: Mar 08, 2007
Posts: 1585
|
posted

0
|
Pay very well attention to these statements Dear John, In the first one, s will contain "Hello Java" Where in the second one, when saying This String literal will be lost! s will contain "Hello" only! For more about Strings and immutability, please refer to the great material enclosed in the K&B book., you will understand everything clearly ... Best of luck ...
|
Vassili ...
SCJP 5.0, SCWCD 1.4, SCJA 1.0
|
 |
marc weber
Sheriff
Joined: Aug 31, 2004
Posts: 11343
|
|
Here's a cool trick...
|
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
|
 |
 |
|
|
subject: String
|
|
|