How can Eclipse create a class with unresolved compilation problems?

后端 未结 3 892
耶瑟儿~
耶瑟儿~ 2020-11-30 02:38

When I try to compile this class with javac, I get a compilation error and Test.class is not created.

public class Test {
    public static void main(String[         


        
3条回答
  •  攒了一身酷
    2020-11-30 03:24

    Yes, Eclipse uses its own special compiler; known as "ecj". From Stack Overflow question What is the difference between javac and the Eclipse compiler?:

    One notable difference is that the Eclipse compiler lets you run code that didn't actually properly compile. If the block of code with the error is never ran, your program will run fine. Otherwise it will throw an exception indicating that you tried to run code that doesn't compile.

提交回复
热议问题