Presents your JAVA E-NEWSLETTER for August 1, 2002 <-------------------------------------------> RECOMPILE CLASSES WHEN CHANGING FINAL VALUES Java compilers optimize final variables by copying them directly into the class file that uses them. This increases the speed of Java programs, but if you change and recompile the original class and don't recompile the classes that use it, the new value won't be copied across. For example, take the two classes, ClassA and ClassB: public class ClassA { static public final int PORT = 80; } public class ClassB { public ClassB() { download(ClassA.PORT); } private void download(int port) { .... } } ClassB will compile so that line 4 reads: download(80); When line 3 of ClassA is changed to: static public final int PORT = 8080; ClassB remains the same. You have to also recompile ClassB to get the line to update and become: download(8080); It's possible to remove the final keyword, but the speed enhancement is something that's often preferred. Make sure that everything gets compiled. If you're using a build tool, such as ant, use ant clean and rebuild if the code starts acting odd. ----------------------------------------