Category: 06. Abstraction

  • Difference between abstract class and interface

    Abstract class and interface both are used to achieve abstraction where we can declare the abstract methods. Abstract class and interface both can’t be instantiated. But there are many differences between abstract class and interface that are given below. Abstract class Interface 1) Abstract class can have abstract and non-abstract methods. Interface can have only abstract methods. Since Java…

  • Interface in Java

    An interface in Java is a blueprint of a class. It has static constants and abstract methods. The interface in Java is a mechanism to achieve abstraction. There can be only abstract methods in the Java interface, not method body. It is used to achieve abstraction and multiple inheritance in Java. In other words, you can say that interfaces can…

  • Abstract class in Java

    A class which is declared with the abstract keyword is known as an abstract class in Java. It can have abstract and non-abstract methods (method with the body). Before learning the Java abstract class, let’s understand the abstraction in Java first. Abstraction in Java Abstraction is a process of hiding the implementation details and showing only functionality…