
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
Extend a Static Inner Class in Java
A static inner class is a nested class which is a static member of the outer class. It can be accessed without instantiating the outer class, using other static members. Just like static members, a static nested class does not have access to the instance variables and methods of the outer class.
You can extend static inner class with another inner class.
Example
public class SampleClass { static abstract class Test{ int num = 300; public abstract void display(); } class DemoClass extends Test{ public void display() { System.out.println("Hi how are you"); } } public static void main(String args[]){ SampleClass obj = new SampleClass(); obj.new DemoClass().display(); } }
Output
Hi how are you
Advertisements