public String concat(String str) {
int otherLen = str.length();
if(otherLen == 0) {
return this;
}
int len = value.length;
char buf[] = Arrays.copyOf(value, len + otherLen);
str.getChars(buf, len);
return new String(buf, true);
}
这return this 返回是哪个
当前调用该方法的类对象
返回调用该方法的对象,比如
s.concat("abc")//返回的是s的this,因为是s调用了方法