Hacker News new | ask | show | jobs
by tpm 1 day ago
Yeah - it's a bit non-intuitive you can change the value of a number.

https://thedailywtf.com/articles/Disgruntled-Bomb-Java-Editi...

2 comments

Such hacks will slowly stop working (without explicitly allowing it from the command line.)

In this example, it would throw an IllegalAccessException, because java.base doesn't open java.lang.

In Python 2 you could literally do

    True = False
and of course in JavaScript

    undefined = "a string"
The terrifying part of this in Java, is that it applies program-wide, including to constants set before you changed the value