fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. C obj = new C();
  14. System.out.println("a: "+obj.a+"b: "+obj.b+"c: "+obj.c);
  15. }
  16. }
  17.  
  18. class A{
  19. int a;
  20. A(){
  21. this.a = 0;
  22. }
  23. }
  24. class B extends A{
  25. int b;
  26. B(){
  27. this.b = 10;
  28. }
  29. }
  30. class C extends B{
  31. int c;
  32. C(){
  33. this.c = 15;
  34. }
  35. }
Success #stdin #stdout 0.05s 4386816KB
stdin
Standard input is empty
stdout
a: 0b: 10c: 15