---
title: "What are inner class and anonymous class"  
description: "What are inner class and anonymous class"  
author: "Pushpendra Singh"  
published: 2010-10-25  
updated: 2020-09-15  
canonical: https://www.mindstick.com/interview/172/what-are-inner-class-and-anonymous-class  
category: "java"  
tags: ["java"]  
reading_time: 1 minute  

---

# What are inner class and anonymous class

Inner class : classes defined in other classes, including those defined in methods are called inner classes. An inner class can have any accessibility including private. \
Anonymous class : Anonymous class is a class defined inside a method without a name and is instantiated and declared in the same place and cannot have explicit constructors.

## Answers

### Answer by Pushpendra Singh

Inner class : classes defined in other classes, including those defined in methods are called inner classes. An inner class can have any accessibility including private. \
Anonymous class : Anonymous class is a class defined inside a method without a name and is instantiated and declared in the same place and cannot have explicit constructors.


---

Original Source: https://www.mindstick.com/interview/172/what-are-inner-class-and-anonymous-class

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
