What is Abstract class ?
Before going to discuss Abstract class, first, we need to know what is
Abstraction?
Abstraction: Hiding the implementation
details and showing only functionality to the user.
i.e., it shows only important things and hides the internal details of
a project.
For example, You can place an order in website like Flipkart, Amazon,
etc.,. but you don't know the internal processing of placing an
order.
In Java, We can achieve abstraction in 2 ways:
1) By using Abstract class (achieve 0
to 100%)
2) By using Interfaces (achieve 100%)
[learn more about
Interfaces]
Abstract Class:
- A class which is declared as abstract keyword is called as Abstract class.
- Abstract class contain abstract methods(method without body) and non-abstract methods (method with body)
NO. Because Abstract class contains abstract methods i.e., methods don't have the implementation. So JVM has no idea how to allocate memory.But, we will take the reference of Abstract class.
Please comment below to feedback or ask questions.
No comments:
Post a Comment
Please comment below to feedback or ask questions.