Click here to Skip to main content
15,996,429 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So I am constructing a Dwarf, however I am getting error:

Quote:
Dwarves_Inheritance.java:8: error: constructor Dwarves in class Dwarves cannot be applied to given types;
Dwarves sleepy = new Dwarves("Sleepy",238,41);
^
required: int,int
found: String,int,int
reason: actual and formal argument lists differ in length
1 error


Here is my code
C#
public class Dwarves_Inheritance
{
   public static void main(String[] args)
	{
		Dwarves sleepy = new Dwarves("Sleepy",238,41);
		System.out.println(sleepy);
	}
}


I have two three other files that don't get error but they make this file run.This is the runner file.
What is wrong with my constructors.

The like to the other files is :
https://gist.github.com/anonymous/689cb32d0b8c0f6b20188caf1bee78bc

What I have tried:

I've tried to change the constructor from it's original form.
Posted
Comments
[no name] 14-Dec-16 15:48pm    
Read the error message, it tells you exactly what the problem is. You are trying to instantiate a Dwarf with a string, int, int when your constructor is only defined with int, int.
[no name] 14-Dec-16 15:55pm    
How would I know? I can't see your code from halfway around the world and I am all out of mind reading potions.
Mohibur Rashid 14-Dec-16 16:17pm    
Where is your Dwarves class ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900