Generic method to print array out - Java java.lang

Java examples for java.lang:int Array

Description

Generic method to print array out

Demo Code


//package com.java2s;

public class Main {
    public static <T> void print(T[] arr) {
        for (int i = 0; i < arr.length; i++)
            System.out.println("[" + i + "]=" + arr[i]);
    }//from w w  w  .jav a2s. c om
}

Related Tutorials