Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect answer in Quiz "Inheritance", Part 9, "Class inheritance" #427

Open
EmilianoEscobedo opened this issue Aug 6, 2023 · 0 comments

Comments

@EmilianoEscobedo
Copy link

In the following quiz, the correct answer is the number 2 but its marked the number 8 as correct.

What does the program print?

public class Counter {

public int addToNumber(int number) {
    return number + 1;
}

public int subtractFromNumber(int number) {
    return number - 1;
}

}


public class SuperCounter extends Counter {

@Override
public int addToNumber(int number) {
    return number + 5;
}

}


public static void main(String[] args) {
Counter counter = new Counter();
Counter superCounter = new SuperCounter();
int number = 3;
number = superCounter.subtractFromNumber(number);
number = superCounter.subtractFromNumber(number);
number = counter.addToNumber(number);
System.out.println(number);
}

Select the correct answer

  • 2 (this is the correct answer)
  • 3
  • 4
  • 7
  • 8 (this is marked as the correct answer in the quizz)
  • 9
@EmilianoEscobedo EmilianoEscobedo changed the title Incorrect answer in Quiz 1, Part 9, "Class inheritance" Incorrect answer in Quiz "Inheritance", Part 9, "Class inheritance" Aug 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant