+ 4
What is the difference between creating String as new() and literal in java?
2 Respostas
+ 9
When you use = new String("string") you create a new String object and when you just use = "string" you refer to the same object.
Read more about this in this article on StackOverflow:
http://stackoverflow.com/questions/3297867/difference-between-string-object-and-string-literal
+ 8
thanks @ Serena so nicely explain