Remove a character from a particular position in a string.

Question:
How can you remove a character from a particular position in a string?

Answer:
Create 2 sub strings. The first one will be everything before the char to be removed. The second one will be everything after the char is removed. Then concatenate the two sub strings together.

Code:
public class RemoveCharacter {
 
   public static void main(String args[]) {
 
      String str1 = "This is java";
 
      // position to remove
      int pos = 8;
 
      String str2 = str1.substring(0, pos) + str1.substring(pos + 1);
 
      System.out.println("Original String: " + str1);
      System.out.println("New String:      " + str2);
   }
}

Output:
$ java RemoveCharacter 
Original String: This is java
New String:      This is ava