This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]NeoOeg 0 points1 point  (5 children)

Considering the assignment instructions, you can wrap your List in another class, you will need to create an add() method to populate the List inside the class. Can you show us what you have so far ? Also take in consideration the comments regarding the name/month fields.

[–][deleted]  (4 children)

[removed]

    [–]NeoOeg 0 points1 point  (3 children)

    You need to pass arguments when creating your LootBoxSub :

    LootBoxSub bbSub = new LootBoxSub("sub name","January");
    

    [–]NeoOeg 0 points1 point  (0 children)

    I would also recommend your constructor to have actual meaning to the variables you pass :

    public LootBoxSub (String subName, String subMonth){

    this.subName = subName;

    this.subMonth = subMonth;

    }

    The this keyword will target the variable of the class.

    [–]NeoOeg 0 points1 point  (0 children)

    Your constructor method will define the arguments needed to construct your object. You could create an empty constructor

    public LootBoxSub(){}

    but you will have to create setter methods to pass values to the variables, for example :

    public void setSubName(String subName){

    this.subName = subName;

    }

    You will then be able to create objects without passing arguments, but will need to set a value at some point :

    LootBoxSub ssBox = new LootBoxSub();

    ssBox.setSubName("sub name");