has private access in error
I've been doing some inheritance lately, and I've writen several programs that use it, and am now encountering the error "_____ has private access in _____". I've done the exact same thing with all my other inheritance programs, so I'm not sure what is wrong. This is the code that I'm getting it on "Driver has private access in Car" is the exact error
and here is the superclass(at least the constructor)
public class DailyDriver extends Car
private boolean Student;
private boolean Worker;
private boolean businessMan;
private double milesPerDay;
public DailyDriver(Car carDriver, boolean s, boolean w, boolean b, double m)
milesPerDay = m;
Student = s;
Worker = w;
businessMan = b;
public class Car
private int Year;
private String make;
private int speed;
private String Type;
private String Name;
private String Driver;
public Car (int Year, String carMake, int topSpeed, String carType, String carName, String carDriver)
this.Year = Year;
this.make = carMake;//brand(ford, chevrolet, etc.)
this.speed = topSpeed;//top speed
this.Type = carType;//sports car, luxury, exoitic, etc.
this.Name = carName;//Mustang, cammaro, etc.
this.Driver = carDriver;//Teenager, Adult, etc.
Re: has private access in error
There are several problems here besides private: no matching constructor and Driver is not initialized yet when you are trying to use it.