Reputation: 35
I have constructor method that looks like the following:
public Profile(List<PointGrade> g)
If i want to call that method in different class, how do I pass argument of type list?
Upvotes: 0
Views: 52
Reputation: 8387
You should create an istance of the object Profile
like this:
List<PointGrade> list = new ArrayList<PointGrade>();
Profile profile =new Profile(list);
And you can use this istance maybe like this:
profile.someMethod();
Upvotes: 1
Reputation: 3075
Create an instance of List:
List<PointGrade> list = new ArrayList<PointGrade>();
Populate it with some data (if you don't want to pass empty list):
PointGrade pg = new PointGrade();
//fill PointGrade fields you need
list.add(pg);
And then pass it to a constructor:
Profile profile = new Profile(list);
Upvotes: 0
Reputation: 3079
List< PointGrade> g=new ArrayList< PointGrade>();
XXX.Profile(g);
Upvotes: 0