• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I add multiple parameters to my ArrayList?  RSS feed

 
Mike Lonsky
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For example, if I have a class called Teacher with the constructor:

public Teacher(double yearsTeaching, boolean isMale, double age)
{
this.yearsTeaching = yearsTeaching;
this.isMale = isMale;
this.age = age;
}


How would I add it to these parameters to my ArrayList in my Tester class?
List<Teacher> teachers = new ArrayList<Teacher>();

Thanks!
 
Campbell Ritchie
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I don't understand the question. You don't add any parameters to the List; you add a Teacher object.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!