What are inner classes?

What are inner classes?

- A class that is nested within a class is called as inner classes.

- The inner class can access private members of the outer class.

- It is mainly used to implement data structure.

- It is a part of nested classes.

- Non-static nested classes are known as Inner classes.

Syntax:
class Outer_Java_Class
{
   //Statements
   class Inner_Java_Class
   {
       //Statements
   }
}

Advantages of Inner Class:

- It can access all the data members and methods of outer class, including private data members and methods.

- This class is used to make code more readable and maintainable.

- Inner class requires less code to write.
Types of JDBC driver
What are the types of JDBC driver? - Type 1 - JDBC - ODBC bridge...
What is a connection pooling?
What is a connection pooling? - It is the technique which allows a connection object to be shared by multiple clients, thus improve program....
What is the difference between C++ & Java?
What is the difference between C++ & Java? - Java does not support typedefs, defines, or a preprocessor. The declaration of named constants is...
Post your comment