public class Stringconversions{
public static void main(
String args[])
{String s1 = "qrst";
String s2 = "wxyz";
StringBuffer sb1 = new StringBuffer("abcd");
int val = 6;
StringBuffer sb2 = new StringBuffer("efgh");
System.out.println(s1 + val);
//System.out.println(sb1 + val); Gives compiler error
//System.out.println(sb1 + sb2); Gives compiler error
System.out.println(s1 + s2);
System.out.println(sb1 + s2);
}}
Can anybody explain why (sb1+s2) doesn't give an error?