本帖最后由 种生祥 于 2012-11-4 01:18 编辑
String s1 = "hello";
String s2 = "hello";//s1,s2是字符串
上面两句与下面两句有什么不同呢?
String s1 = new String("hello");
String s2 = new String("hello");//s1,s2是String类的对象并进行初始化
String s1 = "hello";
等效于
char data[] = {'h','e','l','l','o'};
String s1 = new String(data); |