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

Given:

class Employee {
String name;
double baseSalary;

Employee(String name, double baseSalary) {
this.name = name;
this.baseSalary = baseSalary;
}
}

public class SalesPerson extends Employee {
double commission;

public SalesPerson(String name, double baseSalary, double commission) {
// insert code here Line 13
}
}

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

Given:

class Employee {
String name;
double baseSalary;

Employee(String name, double baseSalary) {
this.name = name;
this.baseSalary = baseSalary;
}
}

public class SalesPerson extends Employee {
double commission;

public SalesPerson(String name, double baseSalary, double commission) {
// insert code here Line 13
}
}

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);

Explanation:



Leave a Reply 1

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