Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote