I am trying to add two bytes.But I am getting "Possible loss of precision" Error.
Also tell me how int and byte different from each other.And when to use byte.
Thanks
int takes up 32 bits (4 bytes) and has a range of -(2^31) to (2^31)-1 (inclusive). byte takes up 8 bits (1 byte ) and has a range of -128 to 127 (inclusive). byte is useful if you only need this limited range.
it's like ... int is the standard computation datatype for decimal numbers in java so every short is automatically converted to an int before computation ... please see about widening and narrowing conversions