Java Arrays toString Short


Java Arrays toString Short

package com.codingdict;

import java.util.Arrays;

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

      // initializing short array
      short[] s1 = new short[] { 20, 70 };

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

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