It gets a little spooky. This code is just typed ... not compiled or tested but I think the basic idea is sound:
Thing one (for cat in hat fans) will be loaded by the default class loader. Thing two will be loaded by a new class loader. If the file thing.class on disk changed since it was first referenced by the default class loader, they might have different versions of the class. That could lead to some very puzzling bugs!
It is done, tho. The
JSP container recompiles and reloads JSPs if they have changed on disk.
JUnit has an option to load the class under
test every time it runs. Some debuggers can reload classes without stopping and restarting a program. But be careful!