EDITED: Looks a little cleaner now, reflects where I currently am and what I'm trying to accomplish, and shows the new issue I'm working on (which has a comment beneath it explaining what I'm getting).
public class Main {
class Terrain
{
private int length, width;
Terrain(int l, int w)
{
length = l;
width = w;
}
public String getTerrainSize()
{
return "Land has dimensions " + length + " X " + width;
}
}
public class Mountain extends Terrain{
private int mounts;
public Mountain(int num, int x, int y) {
//error above: Implicit super constructor Main.Terrain() is undefined. Must explicitly invoke another constructor
//What exactly does this error mean, and how should I fix it?
mounts = num;
length = x;
width = y;
}
public String getMountainSize()
{
return "Mountains have the dimensions " + length + " X " + width + " with a total of " + mounts + " mountains";
}
}
public static void main(String[] args) {
Terrain T1 = new Terrain(400, 200);
T1.getTerrainSize();
Mountain M1 = new Mountain(350, 150);
//error here: The constructor Main.Mountain(int, int) is undefined
//I have a feeling it'll be fixed if I fix the first error, but if not, let me know.
M1.getMountainSize();
}
}
Sorry if the post is getting a bit long, but I want everyone to see the whole picture.