fork download
  1. import java.util.*;
  2.  
  3. interface A { void x(); }
  4. class B implements A { public void x(){} public void y(){} }
  5. class C extends B {public void x(){} }
  6. public class Main {
  7. public static void main(String[] args) {
  8. List<A> list = new ArrayList<A>();
  9. list.add(new B());
  10. list.add(new C());
  11. for(A a : list) {
  12. a.x();
  13. a.y();
  14. }
  15. }
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:13: cannot find symbol
symbol  : method y()
location: interface A
			a.y(); 
			 ^
1 error
stdout
Standard output is empty