Is this valid Java code?

Posted by Eric on Stack Overflow See other posts from Stack Overflow or by Eric
Published on 2010-05-09T14:54:37Z Indexed on 2010/05/09 14:58 UTC
Read the original article Hit count: 187

Filed under:

I'm using Eclipse, and it is perfectly happy with the following code:

public interface MessageType
{
    public static final byte   KICK     = 0x01;
    public static final byte   US_PING  = 0x02;
    public static final byte   GOAL_POS = 0x04;
    public static final byte   SHUTDOWN = 0x08;
    public static final byte[] MESSAGES = new byte[] {
        KICK,
        US_PING,
        GOAL_POS,
        SHUTDOWN
    };
}

public class MessageTest implements MessageType
{
    public static void main(String[] args)
    {
        int b = MessageType.MESSAGES.length;    //Not happy
    }
}

However, the platform that I'm running it on crashes at the line marked above. By crash, think an equivalent of a BSOD. Is there anything wrong with my code, or do I need to pursue the developers of the Java VM for my platform?

© Stack Overflow or respective owner

Related posts about java