Program which concatenates a string

/* Program which concatenates a string */
         
class P18
{
    public static void main(String args[ ])
    {
        StringBuffer str1 = new StringBuffer("Good ");
        String str2 = new String("Day");

        System.out.println(" String1 is : "+str1);
        System.out.println(" String2 is : "+str2);
       
        str1 = str1.append(str2);
        System.out.println(" String after concatenation : "+str1);
    }
}
       

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|