Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

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;
}
Comment

PREVIOUS NEXT
Code Example
Java :: newinstance in java giving exception 
Java :: concludes() Method 
Java :: amstrong 
Java :: priorityQueue peek java 
Java :: Copying Arrays Using arraycopy() method Java 
Java :: string in java 
Java :: java runtime.getruntime().exec 
Java :: java classes and objects 
Java :: can you override static methods in java 
Java :: autowired in spring 
Java :: swapping techniques using java 
Java :: how to set current item for spinner android 
Java :: call activity method from adapter 
Java :: java final method 
Java :: Java if (if-then) Statement 
Java :: result set methods 
Java :: java format double no decimal places 
Java :: java transaction example 
Java :: coin flip in java 
Java :: java forcing user to input int 
Java :: ciclo for para percorere duas listas java 
Sql :: sql server reset identity 
Sql :: how to install mysql ubuntu 
Sql :: turn on foreign keys check mysql 
Sql :: SELECT list is not in GROUP BY clause 
Sql :: Remove mySQL from ubuntu 20.x 
Sql :: query to list all tables in sql database 
Sql :: sql add days to date 
Sql :: oracle select first 10 rows 
Sql :: rermove categories woocommerce sql 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =