Q. What will be the output of following Java code?
Code:
public class Main {
public static void main(String[] args) {
StringBuffer sb = new StringBuffer("include");
sb.append("help");
System.out.println(sb);
}
}
β
Correct Answer: (D)
Includehelp
Explanation: The string here is a StringBuffer hence the contents can be edited which makes the append method work on it by adding 'help' to the end of the string.