Ask Question
3 May, 16:59

Consider the abstract superclass below:

public abstract class Foo

{

private int a;

public int b;

public Foo (int aVal, int bVal)

{

a = aVal;

b = bVal;

} / / end Foo constructor

public abstract int calculate ();

} / / end class Foo

Any concrete subclass that extends class Foo:

1) Must implement a method called calculate.

2) Will not be able to access the instance variable a.

3) Neither (a) nor (b).

4) Both (a) and (b).

+2
Answers (1)
  1. 3 May, 20:01
    0
    4) Both (a) and (b).

    Explanation:

    In addition to regular classes, Java has abstract classes. An abstract class is like a regular class. You can also define fields and methods in an abstract class, while at the same time, you cannot create an object or an instance of an abstract class. Abstract classes are designed to provide basic functionality for derived classes while derived classes required to implement this functionality.

    A derived class must override and implement all abstract methods that are in the base abstract class. Therefore answer a (1) is correct.

    Access modifier for the field a was private which means it has to be provided with accessor methods to obtain/modify its value. Therefor answer b (2) is correct as well.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Consider the abstract superclass below: public abstract class Foo { private int a; public int b; public Foo (int aVal, int bVal) { a = ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers