Long ll = 102; // Error
Byte bb = 101; // No error
Why Long assignment is resulting in compile time error while Byte assignme
long to a Long, an int to an Integer, etc.intSo, it should be clear why the assignment to Long won't work: an int is trying to be cast to a long then auto boxed to a Long in one step... no go.
However, numeric literals in the range -128 to 127 may be interpreted as byte literals in the right context, so that's why the assignment to Byte works.