public static void main(String[] args) {
String s1 = "imooc";String s2 = "imooc";String s3 = "I love " + s1;
System.out.println("s1和s2内存地址相同吗?" + (s1 == s2));System.out.println("s1和s3内存地址相同吗?" + (s1== s3));
String s4 = "I love " + s1;System.out.println("s3和s4内存地址相同吗?" + (s4 == s3));}
String s1 = "imooc";String s2 = "imooc";String s3 = "I love " + s1;
System.out.println("s1和s2内存地址相同吗?" + (s1 == s2));System.out.println("s1和s3内存地址相同吗?" + (s1== s3));
String s4 = "I love " + s1;System.out.println("s3和s4内存地址相同吗?" + (s4 == s3));}
2015-11-06
http://www.imooc.com/ceping/3714http://www.imooc.com/ceping/3714http://www.imooc.com/ceping/3714
2015-11-06
int i=str.length()-3;
while(i>0){
str.insert(i,',');
i=i-3;
}
while(i>0){
str.insert(i,',');
i=i-3;
}
2015-11-06
http://www.imooc.com/code/2208http://www.imooc.com/code/2208http://www.imooc.com/code/2208http://www.imooc.com/code/2208http://www.imooc.com/code/2208http://www.imooc.com/code/2208http://www.imooc.com/code/2208http://whttp://www.imooc.com/code/2208ww.imooc.com/code/2208
2015-11-06
已采纳回答 / sixGod
在java中,不会存在二个同样的对象,而且remove方法是只删一个,当删掉一个后就会return true; 所以就算后面真的存在相同的对象,也不会再删了
2015-11-06
int length = str.length();
while((length = length - 3) > 0){
str.insert(length, ',');
}
while((length = length - 3) > 0){
str.insert(length, ',');
}
2015-11-05