Answers for "remove element at index in java"

0

how to delete character certain index in java

public static String charRemoveAt(String str, int p) {
return str.substring(0, p) + str.substring(p + 1);
}
Posted by: Guest on June-16-2021
0

Java remove element at position from array and shift

static void deleteStudent() {
    System.out.println("Which student would you like to delete?"); //fixed spelling error
    for(int i=0;i<9;i++) {
      System.out.println(i + ": " + studentNamesArray[i]);
    }
    int studentChoice = input.nextInt();
    StudentName[] temp = new StudentName[studentNamesArray.length];//I don't know format
    for(int i = 0; i<studentNamesArray.length; i++) {
        if(i != studentChoice)
        {
            temp[j] = studentNamesArray[i]
         
        }
    }
    temp[studentNamesArray.length-1] = null;
    studentNamesArray = temp;
}
Posted by: Guest on February-15-2022

Code answers related to "remove element at index in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language