| Summary: | The main method can still be run when the java file fails to compile | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | N S <gm65467> |
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
| Status: | CLOSED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | loskutov |
| Version: | 4.17 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 10 | ||
| Whiteboard: | |||
The code is wrong. You can't overload int get() with long get(). |
Why can I still run the main method when the java file fails to compile.Below is the sample Java code: //code start public class Demo extends Super{ public static void main(String[] args) { Super s = new Demo(); System.out.print(s.get()); } public long get() {//Compile Error return 456; } } class Super { public int get() { return 123; } } /* output: 123 */ //code end