class StringBufferDemo
{
public static void main(String[] args)
{
String s1="hello";
String s2="java";
System.out.println(s1+"..........."+s2);
change(s1,s2);
StringBuffer sa1=new StringBuffer("hello");
StringBuffer sa2=new StringBuffer("java");
System.out.println(sa1+"..........."+sa2);
change(sa1,sa2);
}
public static void change(StringBuffer sa1,StringBuffer sa2)
{
sa1=sa2;
sa2.append(sa1);
System.out.println(sa1+"..........."+sa2);
}
public static void change(String s1,String s2)
{
s1=s2;
s2=s1+s2;
System.out.println(s1+"..........."+s2);
}
}
|
|