Java: Interfaces

Published: 25 December 2023
on channel: Jihed
1,285
52

Any suggestions or code improvements are highly appreciated :)
First time na3mel video chabeb be gentle :heart:

🌐 Connect with Me:
Instagram:   / jihed_bz  
Facebook:   / jihed.bz12  
LinkedIn:   / jihed-bouazizi-05b6a5171  

🚀 Latest Project:
🌐 Explore Artovis on Instagram:   / artovis_studio  

Code in this video:
//Main File
public class Main {
public static void main(String[] args) {
/* Interfaces = Houma Templates yethatou on classes
techbah ll inheritence ama el interface tgoul ll classe chniya lezmou ya3mel
classe tnajem timplimenti akther mn interface ama inherite mn super classe wehed
*
Example: Carnivor, Herbivor
Tiger , Rabbit , Bear
*/
Tiger tiger = new Tiger();
Rabbit rabbit = new Rabbit();
Bear bear = new Bear();
tiger.MeatEater();
rabbit.PlantEater();
bear.MeatEater();
bear.PlantEater();

}
}

//Interfaces
public interface Carnivore {
void MeatEater();
}
public interface Herbivore {
void PlantEater();
}

//Classes
public class Bear implements Carnivore, Herbivore{

@Override
public void MeatEater() {
System.out.println("This animal is a meat eater");
}

@Override
public void PlantEater() {
System.out.println("and also a plant eater");
}
}


public class Rabbit implements Herbivore{
@Override
public void PlantEater() {
System.out.println("This animal in a plant eater!");
}
}

public class Tiger implements Carnivore{
@Override
public void MeatEater() {
System.out.println("This animal is a meat eater!");
}
}


On this page of the site you can watch the video online Java: Interfaces with a duration of hours minute second in good quality, which was uploaded by the user Jihed 25 December 2023, share the link with friends and acquaintances, this video has already been watched 1,285 times on youtube and it was liked by 52 viewers. Enjoy your viewing!