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!");
}
}
In questa pagina del sito puoi guardare il video online Java: Interfaces della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Jihed 25 dicembre 2023, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 1,285 volte e gli è piaciuto 52 spettatori. Buona visione!