Discussion
In Java, which keyword prevents a class from being inherited ?
Answer: C
A class is protected from inheritance by the keyword final.
A class declared final cannot be extended: any attempt to write class B extends A, where A is final, fails to compile. String and the wrapper classes such as Integer are final for this reason. The same keyword stops a method being overridden or a variable being reassigned.
static marks members that belong to the class rather than to objects. abstract means the opposite of final: an abstract class exists to be inherited. A top-level class cannot be private in Java.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development