Java

Java

Made by DeepSource

Inefficient use of String constructor JAVA-P0062

Performance
Major

Creating a String using object creation wastes memory because the new String object so constructed will be functionally indistinguishable from the String value passed as a parameter. Just use the string directly.

Bad Practice

String a = new String("abc");

Recommended

String a = "abc";

References