Frage im Vorstellungsgespräch bei Genesys

Difference between: String str = new String("abc"); and String str = "abc";

Antworten zu Vorstellungsgespräch

Anonym

21. Mai 2017

new String("abc") creats a new instance every time we call it whereas = "abc" assigns the singleton object from the memory section called String pool in JVM. Read about flyweight design pattern.

1

Anonym

9. Mai 2017

Literal vs Constant

1