interface G {
default void print() {
System.out.println("G");
}
}
class M {
public void print() {
System.out.println("M");
}
}
class GImpl extends M implements G {}
public class Wierd {
public static void main(String[] args) {
G g=new GImpl();
g.print();
}
}
i was trying to use default method in interface ,but when compile with eclipse i get error on line 2 -says delete default, but i compile and run with command prompt it runs fine,what could be the reason for this?
Java8
version please check it might be less than 8.System.out.println(System.getProperty("java.runtime.version"));
to check.AND More Important: