
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Why Classes are Declared Final in Java
If a class is declared final, you cannot inherit it. If you try it gives you a compile-time error as −
Example
final class Super { private int data = 30; } public class Sub extends Sub { public static void main(String args[]){ } }
Output
Exception in thread "main" java.lang.Error: Unresolved compilation problem: at Sub.main(Sub.java:7)
Advertisements