Java-Appending Any Data Type

Appending Any Data Type

The append( ) method concatenates the string representation of any other type of data to the end of the invoking SringBuffer object.

Program

final2


Program Source

public class Javaapp {
    
    public static void main(String[] args) {
        
        StringBuffer stbr = new StringBuffer();
        
        String str = "1234";
        char c = '5';
        int in = 67;
        float fl = 8.9f;
        
        stbr.append(str);
        stbr.append(c);
        stbr.append(in);
        stbr.append(fl);
        System.out.println("stbr content : "+stbr);
    }
}

Leave a Comment