Java inheritance possibilities tutorial
Especially beginners will be confused about the possibilities of extending classes or implementing interfaces into another class. For example you can think of some questions like this.
- Can we extends multiple abstract classes into one concrete class ?
- Can we extends abstract class into a abstract class ?
- Can we implement multiple interfaces into a abstract class or a concrete class ?
- Can we extends concrete class into a abstract class ?
- ...
Here we are going to summarize all the possibilities into one place so that anyone can refer and memorize easily.
To read more about these things, please follow the below A Tutorial.
Child class | Possible parents | |||||
---|---|---|---|---|---|---|
Single concrete class | Multiple concrete classes | Single abstract class | Multiple abstract classes | Single interface | Multiple interfaces | |
Concrete class | ✔ |
✘ |
✔ |
✘ |
✔ |
✔ |
Abstract class | ✔ |
✘ |
✔ |
✘ |
✔ |
✔ |
Interface | ✘ |
✘ |
✘ |
✘ |
✔ |
✔ |
<< Java interfaces Java keywords and syntax >>