{myadvertisements[zone_1]}
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What are the different types of inner classes?
#1
The different type of inner classes are as follows:-
Local classes
Anonymous classes
Nested top- level classes
Member classes
Reply
{myadvertisements[zone_3]}
#2
A class within a class is called as inner class. Sometimes it is also known as nested class.

There are 4 types of inner classes.

1. Member Inner Class : A class that is a member ( like methods, attributes ) is called as a member inner class.

2. Local Inner Class: A class which is defined in a block( without name) is known as local inner class.

3. Static Inner Class: A class with static modifier in its definition is known as static inner class. Like other static members, a static inner class member is to be referred by its class name.

4. Anonymous Inner Class: A class that has no name and exactly implements only one interface or extends one abstract class is known as anonymous inner class. AWT and Swings uses inner classes to handle various events.


Silpaulin Tarpaulin | Fire Retardant Tarpaulin
Reply
{myadvertisements[zone_3]}
#3
Local classes - Local classes are like local variables, specific to a block of code. Their visibility is only within the block of their declaration.

Member classes - Member inner classes are just like other member methods and member variables and access to the member class is restricted, just like methods and variables.

Anonymous classes - Anonymous classes have no name, you cannot even provide a constructor.


Best Teeth Whitening in Delhi | Cosmetic Dental Treatment in Delhi
Reply
{myadvertisements[zone_3]}
#4
Static Nested Class
Local Inner Class
Anonymous Inner Class
Reply
{myadvertisements[zone_3]}
#5
Type Description
Member Inner Class A class created within class and outside method.
Anonymous Inner Class A class created for implementing interface or extending class. Its name is decided by the java compiler.
Local Inner Class A class created within method.
Static Nested Class A static class created within class.
Nested Interface An interface created within class or interface.
Reply
{myadvertisements[zone_3]}


Possibly Related Threads...
Thread Author Replies Views Last Post
  What are all the types of Pop up boxes available in JavaScript? sulbha 1 13 10-05-2017, 07:45 PM
Last Post: Martinricky
  What are wrapper classes? being.chinmay 0 92 01-27-2016, 08:24 PM
Last Post: being.chinmay

Forum Jump:


Users browsing this thread: 1 Guest(s)
{myadvertisements[zone_2]}