java interface introduction (manohar academy)

Опубликовано: 14 Май 2026
на канале: ManoharAcademy
53
0

welcome to manohar academy.
In this lesson we are going to learn about java interfaces.

Java has two kinds of types.
1) Primitive types
2) Reference types.

New reference types can be created by creating new classes or new interfaces. Interface is nothing but the visible behavior of the class.

Interface can also be thought of as absolute abstract class. A class with abstract methods. Having said that interfaces are different from classes. Interfaces are not classes.

A class that implements a interface should provide implementation for all the abstract methods mentioned in the interfaces. Otherwise the class should be declared as abstract class.

There are 2 types of inheritance.
1) Implementation Inheritance
2) Interface Inheritance.

A class extending from another class is exhibiting Implementation Inheritance.
A class implementing an interface is exhibiting Interface Inheritance.

What is interface?
1. Interface is a reference type
2. Interface is a specification - Specifies list of methods its child class classes should implement
3. Interface is not a class - It does not have any implementation details, just specifications.

Benefits of confirming to interface specification:
Implementing classes will get some services provided for those interfaces. Good example is a class implementing a comparable interfaces. A array of this class can avail Arrays.sort service.