Learn Interface in Java | EasyTechCode

preview_player
Показать описание
#interface #javatutorial #java #javaprogramming #javabasic #javaforbeginners
In this video we learn about interface in java and how to implement interface. Usage of interface with simple example. Also we learn about how to compile and run java program.
Interface in java
_________________
Interface is similar to class.
interface contains static constants data.
Interface contains only abstract methods.
we can create interface using interface keyword
interface sort
{
void sortf();
}
Implementing interface
_______________________
Interface can be implement in another class using implements keyword.
The class that implements the interface should give implementation or definition for abstract methods in interface.
Interface can be implemented by any number of classes.
Interface printi
{
void print();
}
class sortimpl implements printi {
void print()
{ // give definition
}
}
_________________________________________________________________________
Usage of interface
___________________
By using interface can fully abstract a class.
A class can implement any number of interface. We achieve multiple inheritance through interface.
By using interface we can achieve polymorphism, one interface multiple methods.
______________________________________________________________________________________

Other Video Link
________________
How to compile and run java program in notepad
Program to print welcome to java:
Overloading Methods:
Рекомендации по теме
join shbcf.ru