They are not contradictory. The statement in Javadoc that you have quoted is a general statement about all methods. The book is giving you the details of the methods after going through what is written for those methods in the javadoc that are important for the exam.
You can try them out by writing some test code and see what happens.
If you like our products and services, please help us by posting your review here.
'append' method is overloaded in StringBuilder class: append(String),
append(StringBuffer) and append(char[]) etc. In this case compiler gets
confused as to which method `append(null)` can be tagged because
String, StringBuffer and char[] are not related to each other in multilevel
inheritance. Hence `sb.append(null)` causes compilation error.
public class Test
{ public static void main(String[] args)
{ StringBuilder sb = new StringBuilder();
System. out .println(sb.append( null ).length());
}
}
The result of the compilation of code says, ambiguous function call and the reason for that is the explanation given before, but in previous posts you said null can be passed inside append function ? can you explain why ?