Learn Java Coding

Everything You Have To Know About Java

Abstract Class vs Interface Class

PRE-KNOWLEDGDE:

So both are a sketch of the real class you are going to write. This are the 6 differences:

Abstract Class

Interface Class

Explanation

1

You call the class: abstract class + className

You call the class: interface + className

CLICK HERE

2

You use the keyword: extends

You use the keyword: implements

CLICK HERE

3

You can add methods that are already complete and you can add methods that are just a sketch

You only add sketches of methods

CLICK HERE

4

You use variables

You only use constants

CLICK HERE

5

You extend one Abstract Class

You can implement multiple Interfaces

CLICK HERE

6

You can have a constructor

You CANNOT have a constructor, you can only have constants therefore there is no need for a constructor

CLICK HERE

 

Previous Post

© 2024 Learn Java Coding