What will be the output of the following code?

Last Updated :
Discuss
Comments

What will be the output of the following code?

Java
StringBuffer sb1 = new StringBuffer("Java"); StringBuffer sb2 = sb1; sb1.append(" Programming"); System.out.println(sb2); 

Java

Java Programming

Compilation Error

Runtime Exception

Share your thoughts in the comments