All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.
public class Sample{
public static void main(String[] args) {
String s1 = new String("java");
StringBuilder s2 = new StringBuilder("java");
replaceString(s1);
replaceStringBuffer(s2);
System.out.println(s1 + s2);
}
static void replaceString(String s) {
s = s.replace('j', 'l');
}
static void replaceStringBuilder(StringBuilder s) {
s.append("c");
}
}
Pay attention on the call of the method replaceStringBuffer(s2). There is no such a method. The method that should've been called was replaceStringBuilder, so the correct answer is 'None of the above' instead 'javajavac'