crazed monkey

Ian Stevens’ weblog

RSS

Things you shouldn’t be able to do in Java #312

The Fishbowl: When is a constant not a constant?. Charles Miller posts one of those “Guess what this code does” challenges, and it’s in Java. I prayed that I wasn’t right, but was sickened when I ran the code and discovered the worst. Ugh. I’m not all that surprised as sittingDuck is not really a constant, more like a variable which has been initialised to a specific value. Actually, scratch that. I just tried declaring sittingDuck as final and it still works as before. So much for objects as constants.

Tags:
  • none

This entry was posted on Monday, January 13th, 2003 at 1:15 pm and is filed under computers, java, programming. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply