TOP 6 Top 6 Differences: Abstract Class vs Interface in Java

Learn the 6 key differences between abstract classes and interfaces in Java. Essential facts for Java developers! βš™οΈ

TOP 6 Top 6 Differences: Abstract Class vs Interface in Java
Selenium Express
182.7K views β€’ Dec 1, 2017
TOP 6 Top 6 Differences: Abstract Class vs Interface in Java

About this video

This tutorial covers the difference between abstract class and interface.As we go further with this tutorial we are going to learn the top 6 difference when we compare interface vs abstract class in java.

First Lets talk about what is interface in java and what is the use of interface in java ?

So when we know the specification but not aware of the implementation, then we should go for an interface.

Then the next question will be what is abstract class in java and what is the use of abstract class in java ?

The answer is very simple, When we know the partial implementation then we should prefer abstract class.

I will try to demonstrate you the difference between interface and abstract class with a simple example with this tutorial.

β€”β€”β€”β€”β€”β€”

The abstract keyword is used to create an abstract class whereas interface keyword is used to create an interface.

------------------

The variable of an abstract class can have final, non-final, static and non-static variables whereas the variable of an interface should be always public static final.

β€”β€”β€”β€”β€”β€”β€”β€”

Another difference between abstract class and interface in java is :
we can achieve multiple inheritances by using interface whereas with an abstract class it is not possible as multiple inheritance is not supported by java.

β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

An interface can’t have a constructor within it whereas the abstract class can have a constructor within it.know all the reasons why the abstract class does contain a constructor, you can follow the below tutorial by clicking on the link :

[

Why we need constructor inside an abstract class ? || Popular Java interview question

https://youtu.be/jmxOsCGV120

β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

An interface in java can have an only abstract method within it whereas the abstract class in java can have both abstract and concrete method within it.
(FYI: from java 8 we can have both concert and abstract method within an interface )

To know more, watch this tutorial :

INTERFACE IN JAVA 8 with REAL TIME code ||Why DEFAULT Method?[Explained]

https://youtu.be/rjQ0XxcQlFw


β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”

Well, we can have few more differences as well but these are the few common difference between abstract class and interface in java that each developer should
aware of.

-------

Please subscribe to my channel by clicking on the link below.

https://www.youtube.com/channel/UCpUYkSDJpHug-vfC5S-NXRA?sub_confirmation=1

Stay tuned and like my Facebook page for more.
https://www.facebook.com/seleniumexpress/


Music :
-----------
credits : -

Adventures by A Himitsu https://soundcloud.com/a-himitsu
Creative Commons β€” Attribution 3.0 Unportedβ€” CC BY 3.0
http://creativecommons.org/licenses/b...
Music released by Argofox https://youtu.be/8BXNwnxaVQE
Music provided by Audio Library https://youtu.be/MkNeIUgNPQ8


-----

intro template :
wwww.youtube.com/Alexbau01

Video Information

Views

182.7K

Likes

3.6K

Duration

17:48

Published

Dec 1, 2017

User Reviews

4.7
(36)
Rate:

Related Trending Topics

LIVE TRENDS

Related trending topics. Click any trend to explore more videos.