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. class Parent
  8. {
  9. public String name;
  10. public Parent(String pName)
  11. {
  12. this.name = pName;
  13. }
  14. }
  15.  
  16. class Test extends Parent
  17. {
  18. public Test(String Name)
  19. {
  20. name = "hello";
  21. super("kitty");
  22.  
  23. }
  24. }
  25.  
  26. /* Name of the class has to be "Main" only if the class is public. */
  27. class Ideone
  28. {
  29. public static void main (String[] args) throws java.lang.Exception
  30. {
  31. // your code goes here
  32. }
  33. }
Compilation error #stdin compilation error #stdout 0.1s 320512KB
stdin
Standard input is empty
compilation info
Main.java:19: error: constructor Parent in class Parent cannot be applied to given types;
	{
	^
  required: String
  found: no arguments
  reason: actual and formal argument lists differ in length
Main.java:21: error: call to super must be first statement in constructor
		super("kitty");
		     ^
2 errors
stdout
Standard output is empty