Java Classes and Objects
Java Classes and Objects - Important Points
16. | Which of the following is true about abstract classes in Java? |
---|
A. They cannot have constructors.
B. They can be instantiated.
C. They can have both abstract and non-abstract methods.
D. They cannot have any methods implemented.
View Answer Discuss Work SpaceAnswer: option c
Explanation:
17. | Which of the following is true about interfaces in Java? |
---|
A. They can have instance variables.
B. They can be instantiated.
C. They can have both abstract and non-abstract methods.
D. They can have constructors.
View Answer Discuss Work SpaceAnswer: option c
Explanation:
18. | Which keyword is used to implement inheritance in Java? |
---|
A. extends
B. implements
C. super
D. this
View Answer Discuss Work SpaceAnswer: option a
Explanation:
19. | Which of the following is true about the Object class in Java? |
---|
A. It is the parent class of all other classes in Java.
B. It is an abstract class.
C. It provides default implementations for several methods.
D. All of the above.
View Answer Discuss Work SpaceAnswer: option d
Explanation:
20. | Which of the following is not a characteristic of a well-designed class in Java? |
---|
A. It should be easy to understand and use.
B. It should have a single responsibility.
C. It should be tightly coupled with other classes.
D. It should be easy to maintain and extend.
View Answer Discuss Work SpaceAnswer: option c
Explanation: