Find mistake

Report a typo

You've decided to create your own project and for that, you need to employ 1 programmer and 1 team lead. You have written the code for that, but it does not work.

Your task is to find a mistake.

Note: don't rename methods or create your own classes and don't create new objects. Don't use super and this.

Advice: what methods can be inherited?

Sample Input 1:

Time to code

Sample Output 1:

1 programmer
1 teamlead
Write a program in Java 17
class Test {

public static void main(String[] args) {
new TeamLead(1);
}

public static class TeamLead extends Programmer {

private final int numTeamLead;

public TeamLead(int numTeamLead) {
super(numTeamLead);
this.numTeamLead = numTeamLead;
employ();
}

protected void employ() {
System.out.println(numTeamLead + " teamlead");
}

}

public static class Programmer {

private final int numProgrammer;

public Programmer(int numProgrammer) {
this.numProgrammer = numProgrammer;
employ();
}

protected void employ() {
System.out.println(numProgrammer + " programmer");
}
}
}
___

Create a free account to access the full topic