ArrayList tList=new ArrayList();  
byte[] Data=null;
tList.Add(Data);
if(tList.get(0) instanceof byte[]){} else if(tList.get(0) == null){}

解决方案 »

  1.   

    同意楼上的方法
    另外可以用isArray和getClass().getComponentType来判断。
    Demo 如下:public class RtType {
    byte[] bts = new byte[]{0,1,2}; public void testType(Object objs){

    System.out.println("instanceof byte[]?"+(objs instanceof byte[]));
    System.out.println("isArray?"+objs.getClass().isArray());
    if (objs.getClass().isArray()){
        System.out.println("getClass.getComponentType:"+objs.getClass().getComponentType());
    }
    }
    public static void main(String[] args) {
    RtType rt = new RtType();
    rt.testType(rt.bts);
    }
    }
      

  2.   

    感谢 呵呵呵呵呵.我初学java.手上没有参考书 :)