Java Arrays toString Double


Java Arrays toString Double

package com.codingdict;

import java.util.Arrays;

public class ArrayDemo {
   public static void main(String[] args) {

      // initializing double array
      double[] d1 = new double[] { 1.9, 2.9, 3.4 };

      // let us print all the elements available in list
      System.out.println("The array is:");
      for (double number : d1) {
         System.out.println("Number = " + number);
      }

      System.out.println("The string representation of array is:");
      System.out.println(Arrays.toString(d1));    
   }
}