πŸ“Š JAVA
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);
  }
}
  • (A) Error
  • (B) include
  • (C) help
  • (D) Includehelp
πŸ’¬ Discuss
βœ… 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.

Explanation by: Team MCQ Buddy
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.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
257
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
93%
Success Rate