It was a mistake of my co-worker: there was a jar named test.jar and he has fixed a bug of it. Then he re-compile the code and built a new jar named testnew.jar The proble
As far as I can tell, it isn't defined.
Java has a pluggable classloader system, and thus the only way to know what will happen is to look at the documentation of the ClassLoader class, probably in particular the ClassLoader#findClass method, which doesn't define a behavior for this, and to look at the relevant sections of the JLS and JVM specs, neither of which seem to specify a constraint on class loaders in this regard. Thus, unless the behavior is documented by the class loader being used by your web container, you can't know for certain which class will be loaded.
The odds are that the first one found that matches the binary name of the class will be the one loaded, but there's a big difference between behavior we suppose to be the case, and behavior that is specified and/or documented.