1.public class StringTest1 {
publicstaticvoid modify(String value) {value.toUpperCase();
value += "3.0";
System.out.println(value);
}
publicstaticvoid main(String[] args) {
String value = new String("AA");
StringTest1.modify(value);
System.out.println(value);
}
}
2.
publicclass StringTest2 {
publicstaticvoid modify(StringBuilder value) {
value.append("3.0");
System.out.println(value);
}
publicstaticvoid main(String[] args) {
StringBuilder value = new StringBuilder("AA");
StringTest2.modify(value);
System.out.println(value);
}
}
全部评论
(1) 回帖