Java 中的單維陣列
以下是單維陣列的一個簡單示例。
示例
public class Tester { public static void main(String[] args) { double[] myList = {1.9, 2.9, 3.4, 3.5}; // Print all the array elements for (double element: myList) { System.out.print(element + " "); } } }
輸出
1.9 2.9 3.4 3.5
廣告