java - I'm Having an error with calling a constructor with another constructor -
using below code closest solution keep getting error saying "(" or "[" expected , under ";" expected. i'm not sure missing.
public class manager extends salariedsubordinate implements imanager{ private arraylist<isubordinate> listofsubordinates; private double managerbonusfund = 5000; private double basesalary; public manager(double basesalary, imanager manager, arraylist<isubordinate> subordinates) { this.basesalary = basesalary; this.manager = manager; this.listofsubordinates = subordinates;
}
public manager(double basesalary, imanager manager){ this(basesalary, manager, new arraylist<isubordinate> subordinates); }
when create new empty array list, this:
new arraylist<sometype>();
right?
then why did write
new arraylist<isubordinate> subordinates
when pass new array list constructor? ()
s? why add word subordinate
?
so add ()
, delete word subordinate
:
this(basesalary, manager, new arraylist<isubordinate>());
Comments
Post a Comment