I have a question about subclasses and superclasses. In a project I'm working on, I have a superclass called "Team" and some subclasses called "TeamBlue","TeamRed"... Also, all of these subclasses have static fields and methods in them.

My question is: how do I store any subclass object (either TeamBlue or TeamRed) into a "Team" object? if this makes sense.

here is an example of what I'm trying to achieve:

Team team = new BlueTeam(); <-- storing any color team into a "team" object

this is a short version of the code I have:

```
class Team {
    //empty class used for binding all the team classes
}

class BlueTeam extends Team {
    public static List<String> players = new ArrayList<String>();
}

class PlayerData {
    Team playerTeam;
    public PlayerData(Team tm){
        playerTeam = tm;
    }
    playerTeam.players // I want to access any subclass that is stored into this "myTeam" object and access its players list
}

class createData {
    List<PlayerData> data = new ArrayList<PlayerData>();
    // this is what I've tried but I get a null exception
    Team team = new BlueTeam();
    data.add(new PlayerData(team));
}

```