0

I want to change a string object wait a method .who can i do it in java??

22nd Jun 2020, 5:24 AM
Peyman Ramezani
Peyman Ramezani - avatar
3 Answers
+ 1
Hello Peyman Can you explain your question? What do you want to do with your String? I don't know what you mean with "wait".
22nd Jun 2020, 10:09 PM
Denise Roßberg
Denise Roßberg - avatar
+ 1
when i sent a string type to a method it dosent change in main method.why??strings isnt refrence??
23rd Jun 2020, 5:48 AM
Peyman Ramezani
Peyman Ramezani - avatar
0
A string is immutable. If you change it you create a new string object. So your method need to return this new string object.
23rd Jun 2020, 10:30 AM
Denise Roßberg
Denise Roßberg - avatar