+ 4

What is the difference between creating String as new() and literal in java?

2nd May 2017, 7:39 AM
Monarth Sarvaiya
3 Respuestas
+ 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
2nd May 2017, 8:16 AM
ChessMaster
ChessMaster - avatar
+ 8
thanks @ Serena so nicely explain
6th May 2017, 4:06 AM
minakshi singh
minakshi singh - avatar