Question 7 (5 points) Which of the following possible modifications will fix the
ID: 3605680 • Letter: Q
Question
Question 7 (5 points)
Which of the following possible modifications will fix the errors in this code?
public class Test {
private double code;
public double getCode() {
return code;
}
protected abstract void setCode(double code);
}
Question 7 options:
Remove abstract in the setCode method declaration.
Change protected to public.
Add abstract in the class declaration.
b and c.
Remove abstract in the setCode method declaration.
Change protected to public.
Add abstract in the class declaration.
b and c.
Explanation / Answer
The answer is option C. (Add abstract in the class declaration.) When declaring a method as abstract the corresponding class should be declared abstract too.
**Comment for any further queries.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.