I am writing small pieces of code to make sure I understand Java basics and I have the following.
package teams1;
public abstract class Team1{
private String sport = new String();
public abstract String getSport();
public abstract void setSport();
}
import teams1.*;
abstract class FootballTeam1 extends Team1{
public String getSport(){
return "Football";
}
public void setSport(){
this.sport="Football";
}
}
It doesn't compile because sport is private in the super class, but I thought FootballTeam1 would inherit it's own copy of sport because it is extending Team1. Any help would be appreciated. Thanks!