I'm getting an error in my Java code but I can't see whats wrong with it. Help?

前端 未结 5 1764
轻奢々
轻奢々 2021-01-23 14:20

The error i\'m getting is in the fillPayroll() method in the while loop where it says payroll.add(employee). The error says I can\'t invoke add() on an array type Person but th

5条回答
  •  独厮守ぢ
    2021-01-23 14:50

    If for whatever reason you can't use collections. you want to turn:

    payroll.add(employee);
    

    in to:

    this.add(employee);
    

提交回复
热议问题