What are the differences between char and byte? Why text file can be read back as byte streams?
• Everything in computer are represented by 0’s and 1’s, every eight 0’s and 1’s can form a byte, that is why everything can be read in as byte streams. • byte is the smallest memory unit addressable. • How to interpret those bytes is the job of operation system, software, etc. • For Java primitive types, char is 16 bits unsigned integer, byte is 8 bits signed integer, short is 16 bits signed integer. • The difference between char and short is the interpretation of the first bit.