Hi
Can you explain this point regarding append and insert methods to StringBuilder?
If you pass a null, the string "null" is appended to or inserted in the existing StringBuilder. No NullPointerException is thrown.
I am running code below and in both append and insert getting a compile error warning in Intellij for both
StringBuilder sb = new StringBuilder();
sb.append(null);
sb.insert(1, null);
For append:
Ambiguous method call.
append(String) and append(StringBuffer) in StringBuilder match
Insert is similar:
Ambiguous method call.
insert(int, String) and insert(int, char[]) in StringBuilder match
I am confused by this.
Please help
Many Thanks