当前位置:网站首页>Interview question: the difference between three instantiated objects in string class

Interview question: the difference between three instantiated objects in string class

2022-07-27 03:52:00 Chen Yikang

String The difference between the three instantiated objects in the class :

stay JDK1.8 in

1. String str = "hello"

2. String str = new String("hello")

3. String str = new String(new char[]{'h', 'e', 'l', 'l', 'o'})


1.String str = "hello";


 2. String str = new String("hello");


3. String str = new String(new char[]{'h', 'e', 'l', 'l', 'o'});


 

原网站

版权声明
本文为[Chen Yikang]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/208/202207270215504959.html