fork(2) download
  1. class Ideone {
  2. public static void main (String[] args) throws java.lang.Exception {
  3. B b = new B();
  4. A a = b;
  5. int i = a.i;
  6. System.out.println(i);
  7.  
  8. String s = b.i;
  9. System.out.println(s);
  10. }
  11. }
  12.  
  13. class A {
  14. int i = 100;
  15. }
  16.  
  17. class B extends A {
  18. String i = "Hello";
  19. }
Success #stdin #stdout 0.1s 27780KB
stdin
Standard input is empty
stdout
100
Hello