> For the complete documentation index, see [llms.txt](https://liuyang89116.gitbook.io/my-leetcode-book/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://liuyang89116.gitbook.io/my-leetcode-book/core_java_interview_questions/sec_5_nested_classes_and_interfaces.md).

# Sec 5: Nested Classes and Interfaces

## 94) What is nested class?

A class which is declared inside another class is known as nested class. There are 4 types of nested class member inner class, local inner class, annonymous inner class and static nested class.

## 95) Is there any difference between nested classes and inner classes?

Yes, inner classes are non-static nested classes i.e. inner classes are the part of nested classes.

## 96) Can we access the non-final local variable, inside the local inner class?

No, local variable must be constant if you want to access it in local inner class.

## 97) What is nested interface ?

Any interface i.e. declared inside the interface or class, is known as nested interface. It is static by default.

## 98) Can a class have an interface?

Yes, it is known as nested interface.

## 99) Can an Interface have a class?

Yes, they are static implicitely.
