Suppose A is an abstract class, B is a concrete subclass of A, and both A and B have a default constructor. Which of the following is correct?
1. A a = new A();
2. A a = new B();
3. B b = new A();
4. B b = new B();
A.1 and 2
B.2 and 4
C.3 and 4
D.1 and 3
Answers
Answered by
5
I think (3) options is correct
Answered by
0
Option B is Correct:
Explanation:
- In programming languages, an abstract class is a generic class (or sort of object) used as a foundation for developing .
- Abstract methods can't have body. Abstract class may have static fields and static method, like other classes.
- When no access modifier is specified for a class, method, or data member – It is stated to be having the default get right of entry to modifier through default.
- The data members, class or methods which aren't declared the usage of any get right of entry to modifiers i.e. having default access modifier are on hand best in the equal package.
Answer = Option B (2 , 4)
Similar questions
Social Sciences,
6 months ago
Political Science,
6 months ago
Computer Science,
1 year ago
Computer Science,
1 year ago
Math,
1 year ago
Psychology,
1 year ago
Math,
1 year ago