String s = \"hello\"; String backup_of_s = s; s = \"bye\";
At this point, the backup variable still contains the original value \"hello
Strings are immutable objects so you can copy them just coping the reference to them, because the object referenced can't change ...
So you can copy as in your first example without any problem :
String s = "hello"; String backup_of_s = s; s = "bye";