//********************************************** public class Main { public static void main(String[] args) {
Fish fish = new Fish();
fish.hunt(); fish.flee();
} } //********************************************** public interface Prey { void flee(); } //********************************************** public interface Predator { void hunt(); } //********************************************** public class Rabbit implements Prey{ @Override public void flee() { System.out.println("*The rabbit is fleeing*");
} } //********************************************** public class Hawk implements Predator{ @Override public void hunt() { System.out.println("*The hawk is hunting*");
} } //********************************************** public class Fish implements Prey,Predator{ @Override public void hunt() { System.out.println("*The fish is hunting*");
} @Override public void flee() { System.out.println("*The fish is fleeing*");
Very thorough and professional! This guy created the classes and interfaces thren wrote the code right there, whereass our Uni professor copies the code from existing projects and files and pastes it without going through all of the steps with explainations.
I am from Germany but it is the first clear english description which I understand and it is better as the other german description about Interfaces .. thumbs up for you and I will check your other videos, if I will learn more about Java .. thank you
Good Vid Bro, I have a question. What would you recommend I do so that I really internalize all these vids and don't forget the material I've learned? Also my opinion: I fee like the interface is only useful if you need to inherit multiple things.
good question! Try and code something you might find useful for yourself to reinforce the concepts. For example, I play a lot of D&D so I have dice roller programs, character creators, and map builders that I make for practice
This is the best Java tutorial for beginners, so you can learn Java and English in one hit. Please keep going! I vote for Java advance tutorial. Thanks a lot Bro
this actually helped me out so much, thank you! i tried learning these concepts in my class but it got all jumbled and buried under all this jargen, but this is so simple and easy to understand, thanks! :)
Is there an actual reason to use interfaces other than declaring what a class must do? I just feel like it has no other reasons because you only inherant the function name but still have to declare what it does for each individual class.
please keep up the good work i literally straight coming to ur videos for my IT education next time, could u do more of a project tutorial, maybe making a simple game something? that would be great also thank u very much!
So is there ever a situation when it's better to choose inheritance over interface? And are there any other differences besides the possibility to have only one super?
I mean, in inheritance you get everything that the parent class has, the variables and methods. But interfaces don't take variables, only methods without bodies I believe. So in conclusion you should use interfaces to make sure you have all your methods in the wanted class. I guess...
//**********************************************
public class Main {
public static void main(String[] args) {
Fish fish = new Fish();
fish.hunt();
fish.flee();
}
}
//**********************************************
public interface Prey {
void flee();
}
//**********************************************
public interface Predator {
void hunt();
}
//**********************************************
public class Rabbit implements Prey{
@Override
public void flee() {
System.out.println("*The rabbit is fleeing*");
}
}
//**********************************************
public class Hawk implements Predator{
@Override
public void hunt() {
System.out.println("*The hawk is hunting*");
}
}
//**********************************************
public class Fish implements Prey,Predator{
@Override
public void hunt() {
System.out.println("*The fish is hunting*");
}
@Override
public void flee() {
System.out.println("*The fish is fleeing*");
}
}
//**********************************************
Every time you have not understood something at university, our bro is there for us!
u study this in uni, this is taught in high school here
@@agrajyadav2951damn bro, but atleast your getting early exposure in this programing language
Indeed!
@@agrajyadav2951in high school I studied c language and c++ and now this at uni. but where are you living tho??
agree
i spent last few hours trying to understand what interface is an it took you less than 8 mins to explain it perfectly.. you're awesome
Maybe bcs there's not much point in trying to understand what the interface is as a beginner, just have to know how it is used
I absolutely love this guy's teaching style. I especially love that he has pseudo-code up so we know exactly what we are working with.
Very thorough and professional! This guy created the classes and interfaces thren wrote the code right there, whereass our Uni professor copies the code from existing projects and files and pastes it without going through all of the steps with explainations.
It is really understandable and he is telling clearly ,thank you bro
For anyone without a Java IDE, to create a new interface, just make a new java file and put 'public interface ' and its the same thing.
Works even in the same java file…
without the "public" …because you do that so that other .java files can access it.
Watching this 4 year old video right before my exam, worth every second!!
Nice, understanding the relationship between predator and prey brought another layer of clarity. I have been existing without interfaces.
My brain is fried. I will likely never hear the word Hawk the same again
You're hearing weird things when you hear hawk too, eh?
same here lol
tuah!
@@tejirie.9861 say that again
@@bestielwuca4677 hawk.tuah()
THE BEST IN TH-cam
thanks Omar! I'll try my best to have this channel live up to that title
I am from Germany but it is the first clear english description which I understand and it is better as the other german description about Interfaces .. thumbs up for you and I will check your other videos, if I will learn more about Java .. thank you
this channel is so underrated
Big thanks, teacher took 2 hours to try to explain this but you made it understandable.
This is really helpful , thank you for helping me to understand JAVA better ^^ Keep up the great work!!
Good Vid Bro, I have a question. What would you recommend I do so that I really internalize all these vids and don't forget the material I've learned? Also my opinion: I fee like the interface is only useful if you need to inherit multiple things.
good question! Try and code something you might find useful for yourself to reinforce the concepts. For example, I play a lot of D&D so I have dice roller programs, character creators, and map builders that I make for practice
The Hawk is tuahing
Thanks, for this video it has helped me to understand more about interfaces and also learn about what I missed in class today 😊🥰
So much simpler to understand than whatever I was learning. And I can already see how this is useful in more advanced applications
Bro, you got the best tutorials! hopefully to see an AWS tutorial
Every time when I am stuck in JAVA, Bro code always saves me from there. Thank you, Bro!!
great video!!! I'm infinitely grateful for your dedication and big heart to share this knowledge with the world. Thank you soo much
bro i swear to god you are the coolest person ihave ever seen on the internet
Such a great video man, perfectly simple thanks
Next level way to teaching Bro 👍
Bro! That’s amazing! Keep it up
Thanks for the explanation 👍super easy to understand
this is so loud and clear! tnx
Good video
been using your videos to review for my midterm, you've been a big help this semester. thanks, bro :))
This is the best Java tutorial for beginners, so you can learn Java and English in one hit. Please keep going! I vote for Java advance tutorial. Thanks a lot Bro
he is a really good teacher, i appreciate your effort bro.
Your videos are awesome, I understand you better than numerous classes in my college
simple, clean, understandable, thanks thumbs up
this actually helped me out so much, thank you! i tried learning these concepts in my class but it got all jumbled and buried under all this jargen, but this is so simple and easy to understand, thanks! :)
i love the way you simplify subjects ,keep it up bro
Is there an actual reason to use interfaces other than declaring what a class must do? I just feel like it has no other reasons because you only inherant the function name but still have to declare what it does for each individual class.
Lovely explanation, straight to the point!
Thanks, I always look at your videos, they are very easy to understand
The hawk is tuahing
please keep up the good work
i literally straight coming to ur videos for my IT education
next time, could u do more of a project tutorial, maybe making a simple game something?
that would be great
also thank u very much!
thanks Shar!
I have a few games near the end of the full play list if you're interested:
th-cam.com/video/A3jE0GHpRis/w-d-xo.html
Wow. Easy to follow and understandable. Thanks.
nice viode
Great video! thanks for the help bro! keep up the good work :)
I'm from Brazil, thanks for the video bro! ❤
That was Awesome lecture! thx Bro!😄
realy good video thanks
best explanation i've heard... saved me
Thanks so much, Bro Code you made this easy to understand. Now I understand what interfaces are.
Thank you for your clear explaination!
This is AWESOME, ty youre literally teaching me everything
You're the best
Thank you for the tutorial! Is the "@Override" necessary? What does it do?
*thumbs up*
I’ve officially nominated you as my Java professor
Thank you so much sir.
great
Beautiful video
Very informative, thanks.
Clear and crisp👍👍👍
great explanation
Taking Tim Buchalka’s Udemy course. And as much as I am loving it, if there’s ever a time I need something clarified, my bro’s always got my back.
yeah tim got lazy section 10 to 12 it seems, didnt rly explain stuff that well. other than that, excellent course
Nice
Thanks, much clearer than on previous guy's channel lol
HAWK TUAH INTERFAVE ON THAT thang
❤
thanks bro
Thank you so much for your effort
Thanks! Very good explained!
I'm literally in a Java 2 class and they explained interfaces like **** and you just explained it so easy, idk wtf I go to class for
Bro these videos have helped me immensely. This sh!t is so overwhelming.
Ilove Your Tutorial
I have a question….it seems all of these could be done with abstract classes so why have interfaces too? Or am I missing something?
Im going to pass my degree thanks to this guy
you're a LIFESAVER bro
Thank you, your saving my life
תודה לך יהודי יקר וכשר
Hawk?
Hawk Tuah
Great video! thanks!
Thanks, Bro! ☕ You're awesome!
nice
loved it
thanks for the explanation bro
Yeah bro that's awesome thanks
Tanks it was perfect
Hawk.Tuah
love ur shit ur a life saver fr
crisp and clear. Thanks.
Thanks, very helpfull!
I am not good at English. But so easy. thanks Bro
great!!!
Thanks for your tutorials bro!
East or West Bro is the best!
Is it possible to make a universal interface that will work and look ok on the windows as well on the Linux?
Pretty good video
Bro
Nice.
you are awesome dude
Cool man but I need rewatch it later
super nice thanks
So is there ever a situation when it's better to choose inheritance over interface? And are there any other differences besides the possibility to have only one super?
I mean, in inheritance you get everything that the parent class has, the variables and methods. But interfaces don't take variables, only methods without bodies I believe. So in conclusion you should use interfaces to make sure you have all your methods in the wanted class. I guess...