Why does this java code compile

I came across this code public class Main { static int someint; public static void main(String[] args) { someint = -0; print(); } private static int print() { System.out.println(someint); return someint; } } This prints -0 when i run it I was just curios as to how -0 is a legal integer value
i don't think you can compile this. you need to enclose someint = -0; into curly braces

以上就是Why does this java code compile的详细内容,更多请关注web前端其它相关文章!

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

评论 抢沙发

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

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