Which two code fragments, inserted independently at line 13, will compile?

Given:

3. class Employee {
4. String name; double baseSalary;
5. Employee(String name, double baseSalary) {
6. this.name = name;
7. this.baseSalary = baseSalary;
8. }
9. }
10. public class SalesPerson extends Employee {
11. double commission;
12. public SalesPerson(String name, double baseSalary, double commission) {
13. // insert code here
14. }
15. }

Which two code fragments, inserted independently at line 13, will compile? (Choose two.)

Given:

3. class Employee {
4. String name; double baseSalary;
5. Employee(String name, double baseSalary) {
6. this.name = name;
7. this.baseSalary = baseSalary;
8. }
9. }
10. public class SalesPerson extends Employee {
11. double commission;
12. public SalesPerson(String name, double baseSalary, double commission) {
13. // insert code here
14. }
15. }

Which two code fragments, inserted independently at line 13, will compile? (Choose two.)

A.
super(name, baseSalary);

B.
this.commission = commission;

C.
super();
this.commission = commission;

D.
this.commission = commission;
super();

E.
super(name, baseSalary);
this.commission = commission;

F.
this.commission = commission;
super(name, baseSalary);

G.
super(name, baseSalary, commission);



Leave a Reply 0

Your email address will not be published. Required fields are marked *