fork download
  1. class A
  2. {
  3. protected int a = 2;
  4.  
  5. public static void main (String[] args) throws java.lang.Exception
  6. {
  7. B temp = new B();
  8. System.out.println(temp.getAa());
  9. System.out.println(temp.getBa());
  10. }
  11. }
  12.  
  13. class B extends A
  14. {
  15. protected int a = 4;
  16. public int getAa()
  17. {
  18. return super.a;
  19. }
  20.  
  21. public int getBa()
  22. {
  23. return a;
  24. }
  25. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
2
4