package test;
public interface IntA {
void A();
void B();
void C();
void D();
void E();
}
package test;
public class ClsB implements IntA{
public void A() {
System.out.println("A");
}
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Howdyyyy");
IntA a = new ClsB();
a.A();
// a.B(); when uncommented, class doesn't compile
}
}
All right. This class would be compilable even when is marked as "abstract". So, any attempt to compile with javac results to:
K:\UFO_G3\workspace\test>c:\jdk5\bin\javac.exe test/*.java
test/ClsB.java:3: test.ClsB is not abstract and does not override abstract metho
d E() in test.IntA
public class ClsB implements IntA{
^
1 error
as expected. But when in Eclipse, everything is OK but you can't even run such class with this result:
Nebylo možno načíst třídu prostředí Java: java.lang.UnsupportedClassVersionError: test/ClsB (Unsupported major.minor version 49.0)
And I'm asking: why is possible to compile an invalid class ? Why Eclipse using some internal compiler with a non-standard results ? Perhaps that's the reason why I'm using eclipse only as an editor and compiling classes with the Ant ...
No comments:
Post a Comment