Java question: Select whether each of the following is true for abstract classes
ID: 3918212 • Letter: J
Question
Java question:
Select whether each of the following is true for abstract classes only, interfaces only, both, or neither.
can be used as the declared type of an object
a. interfaces only b. neither c.abstract classes only d.both abstract classes and interfaces
can be used as the actual (runtime) type of an object
a. interfaces only b. neither c. abstract classes only d. both abstract classes and interfaces
can have a constructor
a. interfaces only b. neither c. abstract classes only d. both abstract classes and interfaces
can have abstract methods
a. interfaces only b. neither c. abstract classes only d. both abstract classes and interfaces
can contain private variable
a. interfaces only b. neither c.abstract classes only d.both abstract classes and interfaces
Explanation / Answer
ANSWER 1: Here option(B) is correct because both do not have an object type.
ANSWER 2: Here also option(C) is correct because an abstract class can have the constructor.
ANSWER 3: Here option(C) is correct no doubt.
ANSWER 4: here option(D) is correct because both can have abstract methods.
ANSWER 5: Here option(C) is correct only abstract class can have the private variables.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.