This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Originally posted by Kay Liew: KB books stated in page 357.
x.replace('a','A'); System.out.println("x = " + x); //the output is still: x = Java
I got trouble in the //comment. I think the original 'Java" will turns into 'JAvA".
Isn't that so ?
Look at what the x.replace('a','A') statement is really doing. Is it assigning the value it gets from the replace function to the string x or is it just performing the action and throwing the value away?
Joined: Dec 26, 2003
ok ok .. i looked too far
I was thinking of x.replace('a','A'); as x=x.replace('a','A'); .