0

i have a code:

package Main;

public class Rotation {
    public static void main(String[] args) {
        StringBuilder str=new StringBuilder("ABCD");
        for (int i = 0; i < str.length()-1; i++) {
            char temp=str.charAt(0);
            for (int j = 0; j < str.length()-1; j++) {
                str.charAt(j)=str.charAt(j+1);
            }
        }
    }
}

and it gives me error at str.charAt(j)=str.charAt(j+1) i want to assign it? did any one has solution?

  • 2
    https://stackoverflow.com/questions/6952363/replace-a-character-at-a-specific-index-in-a-string – LLL May 01 '22 at 03:25

0 Answers0