Yeah, javac unfortunately creates the illusion it's smarter than it really is. When there are no class files, it compiles them as necessary from the
java files it finds. Afterwards though, if it find a class file it just uses it, without checking to see if maybe there's a new java file to compile. Unless your javac command specifically told it to compile that file. Modern IDEs will generally take care of this for you, but if you're not using one, it's helpful to have some sort of process that guarantees you don't have out-of-date class files lying around. I used to make a small script/batch file for compilation, e.g.
rmdir classes
mkdir classes
javac -sourcepath src -d classes pkg/subpakg/MyClass.java
This assumes all source code is under a directory "src", and puts all classes in another dir "classes", completely regenerated each time. There's a lot more you can do with this, but nowadays you'd probably want to do this with
Ant instead, so I won't go into further detail. The point is, one way or another it's worth your time to make sure you're not dealing with out-of date class files. Deleting all the old class files in a script is one simple way to do it.