Java Strings: “String s = new String(”silly“);”

前端 未结 23 2921

I\'m a C++ guy learning Java. I\'m reading Effective Java and something confused me. It says never to write code like this:

String s = new String(\"silly\");         


        
23条回答
  •  忘掉有多难
    2020-11-22 14:29

    Just because you have the word String in your class, does not mean you get all the special features of the built-in String class.

提交回复
热议问题