print Array - Java Collection Framework

Java examples for Collection Framework:Array Element

Description

print Array

Demo Code


public class Main {

  public static void printArray(int a[]) {

    for (int x : a) {
      System.out.print(x + ",");
    }//  ww  w  .j  a v  a2  s.c  o m
    System.out.println("");
  }

  public static <T> void printArray(T coll[]) {

    for (T i : coll) {
      System.out.print(i + ",");
    }

    System.out.println("");
  }
}

Related Tutorials