Java: 判断是否为Array数组
package com.company; public class Wig{ public static void main(String[] args){ Object[] objects = new String[]{"a", "b", "c"}; if(objects instanceof String[]){ String[] strings = (String[]) objects; for(String string : strings){ System.out.println("string = " + string); } } if(objects == null){ throw new NullPointerException(String.format("%s is null", objects)); } System.out.println("objects.getClass().isArray() = " + objects.getClass().isArray()); } }