Q: java ArrayList with Byte Array : ArrayList cannot be resolved to a type error I am trying to add a byte array in arraylist of bytearrays.
Code: 
    ArrayList<Byte []> bArrayList = new ArrayList<Byte[]>();
    byte[] onekVideofile= new byte[1024];
    in.read(onekVideofile, 0, 1024);
    bArrayList.add(onekVideofile);

    Error: 
    bArrayList cannot be resolved to a type
  - The method add(Byte[]) in the type ArrayList<Byte[]> is not applicable for the   arguments 
 (byte[])

Not sure why its giving error when all three are of type byte array.
Thanks for your time and input,

A: First, byte is not the same as Byte. They are different types. Your ArrayList expects a Byte[] but you are handing it a byte[].
Second, this error message
bArrayList cannot be resolved to a type

seems to indicate that you are invoking
bArrayList.add(onekVideofile);

in the class body. You cannot put statements (method invocations and the like) directly in a class body, you can only put declarations. Put it in a constructor or method body.

A: Although a byte can be auto-boxed into Byte, so that you can pass a byte to a method accepting Byte, the same is not true of arrays. A byte[] can't be passed to an argument accepting Byte[]. Without auto-boxing, they are of course of quite different types and are not otherwise assignable from each other.
