How to replace characters in StringBuilder() using Java

1 Answer

0 votes
package javaapplication1;

import java.io.IOException;

public class JavaApplication1 {

    public static void main(String[] args) throws IOException {

        StringBuilder sb = new StringBuilder("java c c#");

        sb.replace(2, 3, "ww");
        System.out.println(sb);
    }
}


/*
                   
run:

jawwa c c#
          
 */

 



answered Dec 19, 2016 by avibootz

Related questions

1 answer 167 views
3 answers 333 views
1 answer 177 views
1 answer 111 views
1 answer 233 views
...