Java: Having trouble declaring an enum with integer constants

Urgh, I'm kind of confused on how enums work in Java. In C# and C++ (what I use normally), this seems okay, but Java wants to get mad at me >.> enum Direction { NORTH_WEST = 0x0C, NORTH = 0x10, NORTH_EAST = 0x14, WEST = 0x18, NONE = 0x20, EAST = 0x28, SOUTH_WEST = 0x24, SOUTH = 0x30, SOUTH_EAST = 0x3C } Could someone tell me what I'm doing wrong? Thanks Here are the errors: ----jGRASP exec: javac -g Test.java Test.java:79: ',', '}', or ';' expected NORTH_WEST = 0x0C, ^ Test.java:79: '}' expected NORTH_WEST = 0x0C, ^ Test.java:80: expected NORTH = 0x10, ^ Test.java:87: ';' expected SOUTH_EAST = 0x3C ^

以上就是Java: Having trouble declaring an enum with integer constants的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏