Back to Browse

#6.9 Java Tutorial | Why do we need Abstract Class?

124.3K views
Feb 8, 2018
4:56

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

Download

1 formats

Video Formats

360pmp47.2 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

#6.9 Java Tutorial | Why do we need Abstract Class? | NatokHD