Notice


AWT and SWING will be covered soon !

Sunday, September 20, 2009

Replace a Character in a String

image

 

public class strrep
{
    public static void main(String args[])
    {
        char oldchar='A';
        char newchar='Z';
        String str="AAA";


        System.out.println("Old String : "+str);


        str=str.replace(oldchar,newchar);


        System.out.println("New String :"+str);
    }
}

No comments:

Post a Comment