Single dimensional array in Java

Java 8Object Oriented ProgrammingProgramming

Following is a simple example of a single dimensional array.

Example

 Live Demo

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 + " ");
      }
   }
}

Output

1.9 2.9 3.4 3.5
raja
Published on 07-Feb-2018 05:28:05
Advertisements