I have a doubt about why java developers has declared as
public static final int MAX_PRIORITY
public static final int MIN_PRIORITY
public static final int NORMAL_PRIORITY
instead of declaring public static final byte MAX_PRIORITY
. Because for these variables highest value is 10 only. So I think byte is sufficient int range is higher than byte.
Any specific reason behind this? Could someone please explain this to me?
Behind the scenes, the java
int
(on most cases) has the same size as of abyte
(and short type), so it doesn't really matter.byte
is used when it's logical to use it(when the data itself is represented in bytes, like raw data), or in order to save space when you have an array of small numbers.int
is the default type developers use, unless they have a good reason to use something else.