fork download
  1. import java.util.List;
  2. import java.util.Iterator;
  3. import java.util.ArrayList;
  4.  
  5. class FooDemo
  6. {
  7. public static void doFoos(List<? implements Fooable> fooers)
  8. {
  9. Iterator<? extends Fooable> it = fooers.iterator();
  10. while(it.hasNext())
  11. {
  12. it.next().foo();
  13. }
  14. }
  15. public static void main(String[] args)
  16. {
  17. List<ConcreteFoo> myfoos = new ArrayList<ConcreteFoo>();
  18. myfoos.add(new ConcreteFoo());
  19. doFoos(myfoos);
  20. }
  21. }
  22.  
  23. interface Fooable
  24. {
  25. void foo();
  26. }
  27.  
  28. class ConcreteFoo implements Fooable
  29. {
  30. public void foo()
  31. {
  32. System.out.println("Foo!\n");
  33. }
  34. }
  35.  
Compilation error #stdin compilation error #stdout 0.04s 711168KB
stdin
Standard input is empty
compilation info
Main.java:7: error: > expected
  public static void doFoos(List<? implements Fooable> fooers)
                                   ^
Main.java:7: error: ')' expected
  public static void doFoos(List<? implements Fooable> fooers)
                                             ^
Main.java:7: error: ';' expected
  public static void doFoos(List<? implements Fooable> fooers)
                                                     ^
Main.java:7: error: <identifier> expected
  public static void doFoos(List<? implements Fooable> fooers)
                                                             ^
4 errors
stdout
Standard output is empty