---
title: "Why  abstract class are used in Java?"  
description: "Why  abstract class are used in Java?"  
author: "Manish Kumar"  
published: 2017-11-23  
updated: 2017-11-25  
canonical: https://answers.mindstick.com/qa/31104/why-abstract-class-are-used-in-java  
category: "programming"  
tags: ["java programming", "javascript", "opps"]  
reading_time: 1 minute  

---

# Why  abstract class are used in Java?

Why [abstract class](https://www.mindstick.com/articles/92/static-and-abstract-class) are used in [Java](https://www.mindstick.com/articles/1702/introduction-to-java)?

## Answers

### Answer by akriti kashyap

**[Abstract](https://www.mindstick.com/interview/1442/when-to-use-interface-over-abstract-class) [Class](https://www.mindstick.com/articles/12089/arrays-in-java-determining-class-of-an-array-part-8)!**

![Why  abstract class are used in Java?](https://answers.mindstick.com/questionanswer/4b287b3d-8456-4394-9e97-5752434ded9b/images/bf0e33aa-611a-4a88-b493-1524305b2f76.png)\

Declaring abstract to a class, may or may not hold abstract methods are called abstract class. They can only be sub-classed but not instantiated. Static methods and fields may be the part of an abstract class. When they are sub-classed, these sub-classes start implementing abstract methods in their parent class. In case if it does not it can be declared under abstract class.

*Declaration of the abstract method is completed without an implementation. For example:*

```
abstract void add(int x , int y);
```

![Why  abstract class are used in Java?](https://answers.mindstick.com/questionanswer/4b287b3d-8456-4394-9e97-5752434ded9b/images/5fa80593-cd18-4932-aa98-7105097c5b6b.png)\
Abstract classes can be used, under following affirmation:\

- Sharing the code among the closely related classes
- Declaring non-static fields. This would allow modifying and access to the object states to which they are known
- Classes which have been extended from abstract class should have access modifiers except for public those who had been loaded with multiple methods or fields

*Well, it was brief about why are abstract classes used in java...**\**Hope, you enjoyed reading!*\
**Cheers!**


---

Original Source: https://answers.mindstick.com/qa/31104/why-abstract-class-are-used-in-java

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
