More About Strings

public class Main{
    public static void main(String args[]){
        String as="      Mohammad Rakibul Haider        ";
        System.out.println(as);
        System.out.println("The size of the string " + as.length());
        as = as.trim();
        System.out.println("After Trimed");
        System.out.println(as);
        System.out.println("Now the size of the string: " + as.length());
        as = as.concat(" (RHR)");
        System.out.println(as);
        System.out.println("The size of the string: " + as.length());
        String bs="R H R";
        System.out.println(bs);
        bs = bs.replace(" ", "-");
        System.out.println("After Replacing");
        System.out.println(bs);
    }
}

No comments:

Post a Comment