Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

ParentInterfaceUsingChildInnerInterface.java 932B

123456789101112131415161718192021222324252627282930313233
  1. import org.aspectj.testing.*;
  2. /** @testcase PR#645 PUREJAVA Parent interface using public inner interface of child in same file */
  3. interface Child extends Parent {
  4. public interface Inner {
  5. public String ok();
  6. }
  7. }
  8. /** Parent must be in same file as child and be declared AFTER */
  9. interface Parent {
  10. public Child.Inner getChildInner();
  11. }
  12. public class ParentInterfaceUsingChildInnerInterface {
  13. public static void main (String[] args) {
  14. Example me = new Example();
  15. String result = me.getChildInner().ok();
  16. Tester.check(((result != null) && result.startsWith("ok")),
  17. "expected ok... got " + result);
  18. }
  19. }
  20. class Example implements Parent {
  21. public Child.Inner getChildInner() {
  22. return new Child.Inner() {
  23. public String ok() {
  24. return "ok: " + getClass().getName();
  25. }
  26. };
  27. }
  28. }