score:2

Accepted answer

eclipse uses its own java compiler (called ecj) instead of javac. this compiler allows (partial) compilation of broken source files.

score:1

eclipse shouldn't do that. it leads to ambiguous results. if a class couldn't be compiled, then its corresponding .class file should be removed.

if you check the bin folder, b.class and a.class are present. not sure why it creates b.class even though b doesn't compile

score:5

actually, eclipse tries to compile the class and its not able to compile due to build errors, when you simply run those files it executed the previously compiled class, that were successfully compiled earlier (eclipse tries to compile and build the files on every save as per generic settings).

in order to resolve you can try clean the project before running, while in case of javac, it simply compiles ,


Related Query

More Query from same tag