Answers for "Java how to copy a string"

0

Java how to copy a string

Strings are immutable.
Which means you can easily copy a string using this method:

String string1 = "Original String";
String string2 = string1;
string1 = "New String";

and string2 will still be "Original String".
Posted by: Guest on November-22-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language