Zero Constant

Seen recently in the application I’m working on:

private final static int ZERO = 0;

Damn handy if you want to change ZERO to, say, 1 or 10000 everywhere.



  1. And it’s been declared private, because another part of the application may declare another ZERO constant, with another value. And you definitely don’t want any confusion between those …

    Pierre · 2009-01-09 17:00 · #

  2. That’s true. We certainly wouldn’t want that! ;)

    I think this was originally a BigDecimal changed into an int. Obviously, it does look silly now…

    sebastien · 2009-01-21 13:11 · #