What will be the output of the following code?

Last Updated :
Discuss
Comments

What will be the output of the following code?

Java
StringBuilder sb = new StringBuilder("Hello");
sb.append(" World");
System.out.println(sb);

Hello


Hello World

World

Compilation Error

Share your thoughts in the comments