fork download
  1. class supcon
  2. {
  3. private int x,y;
  4. supcon(supcon obj)
  5. {
  6. x=obj.x;
  7. y=obj.y;
  8. }
  9. supcon(int a,int b)
  10. {
  11. x=a;
  12. y=b;
  13. }
  14. void display()
  15. {
  16. System.out.println("value of x is :" + x);
  17. System.out.println("value of y is :" + y);
  18. }
  19. }
  20. class subcon extends supcon
  21. {
  22. private int z;
  23. subcon(subcon obj)
  24. {
  25. super(obj);
  26. z=obj.z;
  27. }
  28. subcon(int a,int b,int c)
  29. {
  30. // super(a,b);
  31. z=c;
  32. super(a,b);
  33.  
  34. }
  35. void display()
  36. {
  37. super.display();
  38. System.out.println("value of z is :" +z);
  39. }
  40. }
  41. class exsuper
  42. {
  43. public static void main(String[] args)
  44. {
  45. subcon obj=new subcon(10,20,30);
  46. obj.display();
  47. subcon obj2=new subcon(obj);
  48. obj2.display();
  49. }
  50. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:29: cannot find symbol
symbol  : constructor supcon()
location: class supcon
   {
   ^
Main.java:32: call to super must be first statement in constructor
	     super(a,b);
	          ^
2 errors
stdout
Standard output is empty