fork(1) download
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. class Main {
  5. public static void main(String[] args) {
  6. FooBar.getFooBar().foo();
  7. }
  8. }
  9.  
  10. class FooBar implements Foo, Bar {
  11. public static <T extends Foo & Bar> T getFooBar(){
  12. return (T) new FooBar();
  13. }
  14.  
  15. @Override
  16. public void bar() {
  17. System.out.println("FooBar.foo()");
  18. }
  19.  
  20. @Override
  21. public void foo() {
  22. System.out.println("FooBar.bar()");
  23. }
  24. }
  25.  
  26. interface Foo {
  27. void foo();
  28. }
  29.  
  30. interface Bar {
  31. void bar();
  32. }
Success #stdin #stdout 0.06s 215552KB
stdin
Standard input is empty
stdout
FooBar.bar()