Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Beginning Java
Stupid question
Popescu Ion
Ranch Hand
Posts: 33
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi everybody,
I have a stupid question. What is wrong with this program, coz i get the same answer all the time = adsdfaw , and i should get = bdsdfbw . Any ideas ? Thnx in advance.
public class test { public static void main(String[] args) { String text = "adsdfaw"; text.replace("a", "b"); System.out.print(text); } }
Popescu Ion
Ranch Hand
Posts: 33
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I get it. Thnx anyway.
Rob Spoor
Sheriff
Posts: 22781
131
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Please
UseRealWords
: "Thanks", not "Thnx".
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
James Elsey
Ranch Hand
Posts: 231
I like...
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
The only stupid questions are those that are never asked ;)
What your seeing is the effects of immutability (is that even a
word
?!).
Strings are immutable so when you give it a value, thats it, you can't change it. You would have to re-assign is or create a new
string
altogether
If you like strawberry rhubarb pie, try blueberry rhubarb (bluebarb) pie. And try this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
NullPointerException - but why?
display the log/output in JSP or HTML page
How to set ID and Value for a JCombobox
how is this possible???
OR | Question
More...