cannot find symbol - constructor Gun()
hey guys new to this site, was just wondering if i could grab some help with an assignment.
i dont know what im doing wrong, any help would be awesome.
This is my PlayerShip class:
public class PlayerShip
{
private int x;
private Gun gun1;
private Gun gun2;
public PlayerShip(int playerx)
{
x = playerx;
gun1 = new Gun();
gun2 = new Gun();
}
}
and this is my Gun class:
public class Gun
{
private int x;
private int power;
private int points;
private int bonus;
private boolean justFired;
public Gun(int gunx, int gunpower)
{
x = gunx;
power = gunpower;
points = 0;
bonus = 1;
justFired = false;
}
Re: cannot find symbol - constructor Gun()
If your question subject is the problem, it has already said what was wrong. It cannot find the default constructor in the Gun class. Default constructor means a constructor that doesn't require a parameter.
If you look at your Gun class you only have a constructor that requires you to pass two ints parameter into it. If you need a default constructor then you need to create one.
Re: cannot find symbol - constructor Gun()
And use code tags, not color tags to post code. If you don't know what that means, go through the FAQs of the site and find out.
db
Re: cannot find symbol - constructor Gun()