You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Parents.java 587B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. public class Parents {
  2. public static void main(String[] args) {
  3. A.I i = new C1();
  4. i.m();
  5. C2 c2 = new C2();
  6. c2.m1();
  7. A.C3 c3 = (A.C3)c2;
  8. C4 c4 = new C4();
  9. c4.m4();
  10. }
  11. }
  12. class C1 {
  13. public void m() { System.out.println("m"); }
  14. }
  15. class C2 {}
  16. class C4 {}
  17. aspect A {
  18. static class C3 {
  19. public void m1() { System.out.println("from C3"); }
  20. }
  21. interface I {
  22. void m();
  23. }
  24. declare parents: (C1 && !C2) implements I;
  25. declare parents: C2 extends C3;
  26. interface I4 {}
  27. public void I4.m4() { System.out.println("I.m4"); }
  28. declare parents: C4 implements I4;
  29. }