Why is possible to concatenate Char and String in Java?
问题 this is what I've tried; public String frontBack(String str) { char begin = str.charAt(0); char end = str.charAt(str.length()-1); return begin+str.substring(1,str.length()-1)+end; } I've thought it would fail since begin and end are chars but it doesn't. How is that possible? Can anyone explain me please? Thanks! 回答1: Java's '+' operator also serves as a concatenation operator. It can concatenate primitives and objects and would return you a string which is its result. The following