I am trying to use byte[] or char[] to read from a socket. I used byte[] and char[], both works fine. However, I know byte is 8 bits and char is 16 bits. Does it matter which one I used?
It does a bit. Hard to say which is better if you don't tell us what you are reading from the socket :) Is your data essentially characters or plain bytes?
I tried to use BufferedReader to read from socket, and the read method only take char[]. That is why I use char[]. It seems to work. The only thing that I'm sure when I use char[] to read byte, does this cause anything problem?
When you deal with streams of plain bytes you should use input/outputstreams, not readers or writers that are meant for character streams. The inputstream equivalent to BufferedReader is BufferedInputStream and there is a method for reading a full byte[] there...
But using a "bigger" data type than you need will not cause you big problems.