Since String objects are immutable, going to a char via toCharArray, swapping the characters, then making a new String from char via the String(char) constructor would work. The following example swaps the first and second characters: String originalString = "abcde";...
  • April 3, 2022
  • 0 Comments