cannot find symbol error when using "extends"

I'm learning java inheritence and access control, but I'm not understanding "extends" correctly.  I have two very basic classes in two separate files:
class Baseball6 {

private String city;
protected String state;
private int centerField;
protected int leftField;
public int rightField;

Baseball6(String in1, String in2, int in3, int in4, int in5){
city = in1;
state = in2;
centerField = in3;
leftField = in4;
rightField = in5;
and then:
class ParkPlayers {

private String name;
public String team;
protected int year;

public static void main(String[] arguments) {
Baseball6 wrigley = new Baseball6("Chicago", "Illinois", 390, 345, 395);

System.out.println("Wrigley Field is in " + wrigley.state);
System.out.println("Left field is " + wrigley.leftField + "feet.");

when I compile ParkPlayers as listed above, everything is fine.  But if I put:

class ParkPlayers extends Baseball6

I get the error: cannot find symbol
symbol  : constructor Baseball6()
location: class Baseball6
class ParkPlayers extends Baseball6{
1 error

So I guess I don't understand.  I've researched the issue and can't seem to find the simplistic answer I'm looking for.  Any explanation of what I'm doing wrong would be greatly appreciated.

Who is Participating?
ozlevanonConnect With a Mentor Commented:
The message is:
symbol  : constructor Baseball6()
This appears because the compiler tries to find an empty constructor (i.e. a constructor without any arguments) in class Baseball6. The compiler does this because your class ParkPlayers has no explicit constructor defined, and so java uses an empty constructor by default.
In order to create a new ParkPlayers object, java has to call this empty constructor, but since ParkPlayers extends Baseball6, when its constructor is called, it must call the super class constructor, namely Baseball6's empty constructor. However, Baseball6 has no empty constructor.
To fix this you must do one of two:
1. Define an empty constructor in Baseball6
2. Define a constructor in ParkPlayers which accepts the exact same arguments as the one in Baseball6: (String in1, String in2, int in3, int in4, int in5)
17haat17Author Commented:
Thank you.  I followed suggestion 1, and that worked perfectly.  Funny, none of that information you provided was explained in the book I'm using....but it's obviously critical.  They just show classes extending classes extending classes.  Even their own examples don't compile.  Thanks again!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.