You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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
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 class SuperCounter extends Counter {
}
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
The text was updated successfully, but these errors were encountered: