In general if a variable is declared final, we cant override the value of that variable but this doesn't hold good when we use string buffer. Can someone let me know why?
The below code works!!!!!!
public static void main(String args[]) {
final StringBuffer a=new StringBuffer("Hello");
a.append("Welcome");
System.out.println(a);
}
Output:
HelloWelcome