- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are inner classes in Java?
Java allows writing classes within classes and the class which is written inside another is known as inner class.
- Inner classes are a kind of security mechanism in Java.
- You can declare an inner class private once you do it cannot be accessed from an object outside the class.
Java supports three kinds of inner classes.
- Inner Class
- Method-local Inner Class
- Anonymous Inner Class
Example
Public class Outer{ class Inner{ } }
- Related Articles
- What are anonymous inner classes in Java?
- What are method local inner classes in Java?
- How are anonymous (inner) classes used in Java?
- What is the difference between static classes and non-static inner classes in Java?
- How many types of anonymous inner classes are defined in Java?
- Why do we need inner classes in Java?
- What are Java classes?
- What are final classes in Java?
- What are abstract classes in Java?
- What are wrapper classes in Java?
- What are I/O classes in Java?
- What are Java parent and child classes in Java?
- What are the different types of classes in Java?
- What are the differences between Java classes and Java objects?
- What are the different types of nested classes are defined in Java?

Advertisements