Java Classes and Objects
Java Classes and Objects - Important Points
36. | Which of the following is true about abstract classes in Java? |
---|
A. They can be instantiated.
B. They can contain abstract methods.
C. They cannot contain concrete methods.
D. They cannot be inherited.
View Answer Discuss Work SpaceAnswer: option b
Explanation:
37. | Which of the following is true about interfaces in Java? |
---|
A. They can be instantiated.
B. They can contain concrete methods.
C. They can contain instance variables.
D. They cannot contain constructor.
View Answer Discuss Work SpaceAnswer: option d
Explanation:
38. | Which of the following is true about constructors in Java? |
---|
A. They can be inherited.
B. They can be overridden.
C. They can be private.
D. They can have a return type.
View Answer Discuss Work SpaceAnswer: option c
Explanation:
39. | Which of the following is true about the super keyword in Java? |
---|
A. It refers to the superclass of the current class.
B. It refers to the subclass of the current class.
C. It refers to the current object.
D. It refers to the current class.
View Answer Discuss Work SpaceAnswer: option a
Explanation:
40. | Which of the following is true about encapsulation in Java? |
---|
A. It allows the state of an object to be accessed directly.
B. It allows the state of an object to be accessed only through methods.
C. It allows the state of an object to be accessed only through variables.
D. It allows the state of an object to be accessed through both variables and methods.
View Answer Discuss Work SpaceAnswer: option b
Explanation: