>

Friday, December 7, 2012

String Replace in Java

Most of us know that replace function in  String is only works with characters. As work within single quotes.. But String replace function also works fine with double quotes.

public class StringManipulation {

    public static void main(String args[]){

        String name="commission";
        name=name.replace("i","j");
        System.out.println(name);
    }
}


OUTPUT

commjssjon

No comments:

Post a Comment

Please post your comments. Your comments make us to write more programs for you.