Monday, July 11, 2016

Consider:
{
public final byte VALUE1 = 0xF0;
public final byte VALUE2 = 0x10;
}

The highlighted part is an error. Really?

OK, Java developers aren't allowed to determine the size of a variable (they should just know that float is always 32-bits) but when initialising a byte to anything >127 (0x7F) Java thinks it's a negative number and therefore cannot be assigned to a byte. WTF, Java?

Come on.

Here is a workaround:
{
public final byte VALUE1 = (byte)0xF0;
}

Fucking Java...

No comments:

Post a Comment