Java Tutorial: Why Use Abstract Classes? ๐
Learn why abstract classes are essential in Java for hiding implementation details and showing only necessary functionality.

Telusko
123.8K views โข Feb 8, 2018

About this video
Abstraction is a process of hiding the implementation details and showing only functionality to the user.
Need of an abstract class:-
- Java Abstract class is used to provide common method implementation to all the subclasses or to provide a default implementation.
- We can run an abstract class in java like any other class if it has a main() method.
- We create an abstract class when we don't want anyone to create an object of an abstract class.
- Instead of wasting two methods, we can only use one method which accepts all the subclass objects.
e.g.,
class Printer{
public void show(Integer i)
{
}
public void show(Double i)
{
}
}
- Here, both Integer and Double extend the Number class.
- Instead of it, we can simply use Number.
class Printer{
public void show(Number i)
{
}
}
- So, the advantage of using a Number is that it will support both Integer and Double type values.
- Number is an abstract class so we do not need to create an object for it.
In this video we will see:
- Abstraction
- Why do we need an abstract class?
- Example of an abstract class
- Number class example
Instagram : https://www.instagram.com/navinreddyofficial/
Linkedin : https://in.linkedin.com/in/navinreddy20
Discord : https://discord.gg/aXPF5hV7
More Learning :
Java - https://bit.ly/3xleOA2
Python :- https://bit.ly/3H0DYHx
Django :- https://bit.ly/3awMaD8
Spring Boot :- https://bit.ly/3aucCgB
Spring Framework :- https://bit.ly/3GRfxwe
Servlet & JSP :- https://bit.ly/3mh5CGz
Hibernate Tutorial :- https://bit.ly/3NWAKah
Rest API | Web Service Tutorial :- https://bit.ly/38RJCiy
Git :- https://bit.ly/3NUHB3V
JavaScript :- https://bit.ly/3mkcFys
Kotlin :- https://bit.ly/3GR2DOG
Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20
http://www.telusko.com/contactus
Need of an abstract class:-
- Java Abstract class is used to provide common method implementation to all the subclasses or to provide a default implementation.
- We can run an abstract class in java like any other class if it has a main() method.
- We create an abstract class when we don't want anyone to create an object of an abstract class.
- Instead of wasting two methods, we can only use one method which accepts all the subclass objects.
e.g.,
class Printer{
public void show(Integer i)
{
}
public void show(Double i)
{
}
}
- Here, both Integer and Double extend the Number class.
- Instead of it, we can simply use Number.
class Printer{
public void show(Number i)
{
}
}
- So, the advantage of using a Number is that it will support both Integer and Double type values.
- Number is an abstract class so we do not need to create an object for it.
In this video we will see:
- Abstraction
- Why do we need an abstract class?
- Example of an abstract class
- Number class example
Instagram : https://www.instagram.com/navinreddyofficial/
Linkedin : https://in.linkedin.com/in/navinreddy20
Discord : https://discord.gg/aXPF5hV7
More Learning :
Java - https://bit.ly/3xleOA2
Python :- https://bit.ly/3H0DYHx
Django :- https://bit.ly/3awMaD8
Spring Boot :- https://bit.ly/3aucCgB
Spring Framework :- https://bit.ly/3GRfxwe
Servlet & JSP :- https://bit.ly/3mh5CGz
Hibernate Tutorial :- https://bit.ly/3NWAKah
Rest API | Web Service Tutorial :- https://bit.ly/38RJCiy
Git :- https://bit.ly/3NUHB3V
JavaScript :- https://bit.ly/3mkcFys
Kotlin :- https://bit.ly/3GR2DOG
Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20
http://www.telusko.com/contactus
Video Information
Views
123.8K
Likes
1.6K
Duration
4:56
Published
Feb 8, 2018
User Reviews
4.5
(24) Related Trending Topics
LIVE TRENDSRelated trending topics. Click any trend to explore more videos.
Trending Now