来自阵列的特定元素的Java打印数据


来自阵列的特定元素的Java打印数据

public class DeletingElementsBySwapping {

   public static void main(String args[]) {

      int [] myArray = {23, 93, 56, 92, 39};

      System.out.println("hello");

      int size = myArray.length;

      int pos = 2;



      for (int i = pos; i<size-1; i++) {

         myArray[i] = myArray[i+1];

      }



      for (int i=0; i<size-1; i++) {

         System.out.println(myArray[i]);

      }

   }

}