首页 > 代码库 > 【Java】String str = new String("abc");问题

【Java】String str = new String("abc");问题

String str = new String("abc");

 

构造方法说明:java.lang.String.String(String original)

 

解释:Initializes a newly created String object so that it represents the same sequence of characters as the argument; in other words, the newly created string is a copy of the argument string. Unless an explicit copy of original is needed, use of this constructor is unnecessary since Strings are immutable.

【Java】String str = new String("abc");问题