fork download
  1. class Ideone {
  2. public static void main (String[] args) {
  3. A a=new A();
  4. B b=new B();
  5. a.test();
  6. b.test();
  7. b.suptest();
  8. }
  9.  
  10. static class A {
  11. String aString="A.aString set from A";
  12. void test() {
  13. System.out.println("A.test(): "+aString);
  14. }
  15. }
  16. static class B extends A {
  17. String aString="B.aString set from B";
  18. {
  19. super.aString="A.aString set from B";
  20. }
  21. void test() {
  22. System.out.println("B.test(): "+aString);
  23. }
  24. void suptest() {
  25. System.out.print("B.suptest() calling super.test(): ");
  26. super.test();
  27. }
  28. }
  29. }
Success #stdin #stdout 0.09s 50036KB
stdin
Standard input is empty
stdout
A.test(): A.aString set from A
B.test(): B.aString set from B
B.suptest() calling super.test(): A.test(): A.aString set from B