📜  使用 for 循环访问 Java 数组元素 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:59.591000             🧑  作者: Mango

代码示例1
class ArrayUsingLoop
{
    public static void main (String[] args)
    {        
      int[] newArray;
         
      newArray= new int[5];
         
      newArray[0] = 1;
      newArray[1] = 2;
      newArray[2] = 3;
      newArray[3] = 4;
      newArray[4] = 5;
         
      for (int i = 0; i < newArray.length; i++)
         System.out.println("Array Element at index " + i +
                                      " : "+ newArray[i]);         
    }
}