http://www.verejava.com/?id=16992656053526
/* Title: Delete Scores array index value idea of index position: 1. Create a temporary array Temparray 2 that is temporarily 1 smaller than scores. Copy the data in front of index to Temparray in front of 3. Copy the array after index to Temparray after 4. Assigns a Temparray address pointer reference to scores 5. Print output Scores*/import Java.util.scanner;public class arraydelete{public static void Main (string[] args) {//one-dimensional number Definition and initialization of the group int[] scores={90,70,50,80,60,85}; System.out.println ("Please enter the index to delete:"); Scanner in=new Scanner (system.in); int Index=in.nextint (); 1. Create a temporary array that is temporarily 1 smaller than scores temparray int[] Temparray=new int[scores.length-1]; 2. Copy the data in front of index to Temparray front//3. Copy the array after index to Temparray after for (int i=0;i<scores.length;i++) {if (I<index) Temparray[i]=scores[i]; if (I>index) temparray[i-1]=scores[i]; }//4. Assigns the Temparray address pointer reference to the scores scores=temparray; 5. Print output scores for (int i=0;i<scores.length;i++) {System.out.print (scOres[i]+ ","); } }}
http://www.verejava.com/?id=16992656053526
One-dimensional array of Java arrays delete elements