Why stringbuilder stops adding elements after using the null character?
问题 When i am using the null character '\u0000' , stringbuilder will stop appending new elements. For example: StringBuilder _stringBuilder = new StringBuilder(); _stringBuilder.append('\u0000'); _stringBuilder.append('a'); System.out.println("."+_stringBuilder+"."); returns . I understand that the null value should not be printed (or printed like if it was a null String value) but in this case, why does stringbuilder is failing to add more elements ? Note: I am using jdk 1.6.0_38 on ubuntu. 回答1: