Question: Help with comment and explain what the beow Java code does and is it a constructor or method? or both? and explain @Override. Thanks! import

Help with comment and explain what the beow Java code does and is it a constructor or method? or both? and explain @Override. Thanks! import java.util.Scanner;
class Human extends Player {
private Scanner scanner;
public Human(String name){
super(name);
scanner = new Scanner(System.in);
}
@Override
public int makeMove(int currentSticks){
System.out.println(name +", enter number of sticks to take (1 to "+ currentSticks /2+"): ");
int sticks = scanner.nextInt();
while (sticks <1|| sticks > currentSticks /2){
System.out.println("Invalid number of sticks. Try again: ");
sticks = scanner.nextInt();
}
return sticks;
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!