标签:blog io ar for java on div log cti
package ReflectionMethod; import java.lang.reflect.Array; public class ReflectionArrayPrint { public static void main(String[] args) { int[] a=new int[]{1,2,3}; printArray(a); } public static void printArray(Object obj) { Class cl=obj.getClass(); if(cl.isArray()){ int len=Array.getLength(obj); for(int i=0;i<len;i++){ System.out.println(Array.get(obj, i)); } }else { System.out.println(obj); } } }
标签:blog io ar for java on div log cti
原文地址:http://www.cnblogs.com/zjsy/p/4150415.html