在Java中将单个字符附加到字符串或char数组?
问题内容:
是否可以在Java中将单个字符附加到数组或字符串的末尾
例如:
private static void /*methodName*/ () {
String character = "a"
String otherString = "helen";
//this is where i need help, i would like to make the otherString become
// helena, is there a way to do this?
}
问题答案:
1. String otherString = "helen" + character;
2. otherString += character;