//**************************************** public class Main { public static void main(String[] args) {
// polymorphism = greek word for poly-"many", morph-"form" // The ability of an object to identify as more than one type
Car car = new Car(); Bicycle bicycle = new Bicycle(); Boat boat = new Boat();
Vehicle[] racers = {car,bicycle,boat};
for(Vehicle x : racers) { x.go(); }
} } //**************************************** public class Vehicle { public void go() { // TODO Auto-generated method stub
} } //**************************************** public class Car extends Vehicle{ @Override public void go() { System.out.println("*The car begins moving*"); } } //**************************************** public class Bicycle extends Vehicle{ @Override public void go() { System.out.println("*The bicycle begins moving*"); } } //**************************************** public class Boat extends Vehicle{ @Override public void go() { System.out.println("*The boat begins moving*"); } } //****************************************
I know im asking randomly but does any of you know a way to get back into an Instagram account?? I somehow forgot the login password. I appreciate any tips you can give me
@Billy Dominic i really appreciate your reply. I found the site thru google and Im in the hacking process atm. Looks like it's gonna take quite some time so I will reply here later when my account password hopefully is recovered.
I had struggled with figuring out what polymorphism is for weeks But with just watching this video I feel the power in my hands, everything is so clear now I extremely respect what you did
another way is to use instanceof inside the for loop, we each time check : if ( x instanceof Car ) x.go(); if ( x instanceof Bicycle ) x.go(); if ( x instanceof Boat ) x.go(); In case someone don't want to redefine the method go in superclass
my classmates and my batchmates kept on asking me how come i already know all the topics our professor taught.. i told them i binged watch youtube tutorial on your channel and ask them favor subscribe , like and comment . so you'll make more videos for us... we learned so much from you more than what is taught in our school we so much appreciate your efforts bro..🥰🥰🥰
Thank you for the Video, you explained it amazingly. I didn´t need to wind the video back, I just got it instantly (and i´m usually one of the slow learners)! I will definitely come back and learn more! :)
Loop Through an Array with For-Each There is also a "for-each" loop, which is used exclusively to loop through elements in arrays: for (type variable : arrayname) { ... } example:- String[] cars = {"Volvo", "BMW", "Ford", "Mazda"}; for (String i : cars) { System.out.println(i); } output:- Volvo BMW Ford Mazda
Thanks, nice video. In this case the parent class can be modified and x method was included. What if we need to extend somebody's else class? Implement an Interface?
//****************************************
public class Main {
public static void main(String[] args) {
// polymorphism = greek word for poly-"many", morph-"form"
// The ability of an object to identify as more than one type
Car car = new Car();
Bicycle bicycle = new Bicycle();
Boat boat = new Boat();
Vehicle[] racers = {car,bicycle,boat};
for(Vehicle x : racers) {
x.go();
}
}
}
//****************************************
public class Vehicle {
public void go() {
// TODO Auto-generated method stub
}
}
//****************************************
public class Car extends Vehicle{
@Override
public void go() {
System.out.println("*The car begins moving*");
}
}
//****************************************
public class Bicycle extends Vehicle{
@Override
public void go() {
System.out.println("*The bicycle begins moving*");
}
}
//****************************************
public class Boat extends Vehicle{
@Override
public void go() {
System.out.println("*The boat begins moving*");
}
}
//****************************************
I know im asking randomly but does any of you know a way to get back into an Instagram account??
I somehow forgot the login password. I appreciate any tips you can give me
@Kalel Darian Instablaster =)
@Billy Dominic i really appreciate your reply. I found the site thru google and Im in the hacking process atm.
Looks like it's gonna take quite some time so I will reply here later when my account password hopefully is recovered.
@Billy Dominic it worked and I now got access to my account again. Im so happy:D
Thanks so much you saved my account :D
@Kalel Darian Happy to help :D
The ammount of times this man has saved me this semester is unreal.
Better than my teachers ❤️
thanks Abhishek!
Ofcourse
Not even comparable to mines😂
@@bestechdeals4539 same here
😂
I had struggled with figuring out what polymorphism is for weeks
But with just watching this video
I feel the power in my hands, everything is so clear now
I extremely respect what you did
same :v ổng giảng cuốn thật
@@anleuc3246 tưởng có mỗi tôi là người Việt subscribed kênh này :v
ui cong dong nguoi viet day roi, chao cac ban, chuc cac ban hoc vui va thanh cong trogn su nghiep
another way is to use instanceof inside the for loop, we each time check :
if ( x instanceof Car ) x.go();
if ( x instanceof Bicycle ) x.go();
if ( x instanceof Boat ) x.go();
In case someone don't want to redefine the method go in superclass
we call it narrowing down in polymorphism
Wow, astonished on how well explained that was. Great video.
my classmates and my batchmates kept on asking me how come i already know all the topics our professor taught.. i told them i binged watch youtube tutorial on your channel and ask them favor subscribe , like and comment . so you'll make more videos for us... we learned so much from you more than what is taught in our school we so much appreciate your efforts bro..🥰🥰🥰
good mr bro
I appreciate your help in making this lesson easy.
Great video simple and clear
You are the best Bro. I really appreciate what you did. May the God bless you and keep you enjoy with a happy and relax life all the time.
As always: a brilliant and helpful tutorial vid! I really appreciate you content, it really helps me learn Java!
Keep up the good work bro!
great video bro! Also in your examples can you include user input, i think its an important skill to memorize
Thanks great job keep going
very good teachin and clear example. Thank you!
This is the best video to understand polymorphism. No doubt! Thank you a lot Bro ❤
Very good video thank you from Kazakhstan
Better than God Viedeo
thanks for your best explanation
This is my 2# step. Great video bro
Thank you for making these videos. Great content.
nicely explained, thanks good for repeating :))
Thank you for the Video, you explained it amazingly. I didn´t need to wind the video back, I just got it instantly (and i´m usually one of the slow learners)!
I will definitely come back and learn more! :)
concise and precise.Thanks
Awesome explanation as always!
great video!!! I'm infinitely grateful for your dedication and big heart to share this knowledge with the world. Thank you soo much
Your explanations are perfect
Thanks for this videos, you are the best lecturer bro!
Great example
thank you so much, i watched many vids trying to learn this stuff, no one can teach it like you do
You are the best, thank you for helping me through college
I didn't know u could tell a for loop to go through all entries of an array. That's super useful
Loop Through an Array with For-Each
There is also a "for-each" loop, which is used exclusively to loop through elements in arrays:
for (type variable : arrayname) {
...
}
example:-
String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};
for (String i : cars) {
System.out.println(i);
}
output:-
Volvo
BMW
Ford
Mazda
@@mohammeds6314 thanks
@@hytalefanboi7471 most welcome:)
Powerful,very educ
ative and easy to understand,thanks bro code
Thanks for your video
Easy as f**k, thank u Bro.
That was incredible good explained. Thanks!
very helpful, thanks
Nice bro. Right to the point. Gracias.
Best explanation
amazing
Goat of all bro
Brilliant tutorial!
your vids are great
Awesome
great video !!!
totally amazing tutorial, you got my subscribe after the second video. Thank you so much sir!
Well this was more effective than my W3Schools, school lesson, and ChatGPT combination learning method. Thanks Bro Code!
Thanks 🎉
Nice!
Great video
You are a god of gods
great job!!!
You are the GOAT!!!
Thanks🎉
Nice.
This was a good video
youre the best ❤
Wow!
Gods bless you.
Nice bro keep going you are well🙏
This helped a lot, thanks!!
Very clear video
now I'm a hero thanks to you Bro
As simple as that . THANKS Bro
nice work bro
Thanks Bro
Great stuff!! 💪
Thanks a lot bro
Thanks for the lesson!
❤❤❤❤
thanks bro
Thanks, nice video. In this case the parent class can be modified and x method was included. What if we need to extend somebody's else class? Implement an Interface?
nice
Bro, you are the best!
Nice
Good
I like it!
super clear thanks
Thank you so much sir.
all love your amazing mate
Good bro
Thank You So Much
Nice bro
Good job!
best brooo
thanks man. keep up
Thank you very much!!!
I was talked to and learned something new (y)
The best 🤍🤍
smashed the like button;
dropped comment;
subscribed;
so now I'm fellow bro, bro;
this was helpful, thx
tx bro
Thanks bro :)
thanks
very good for me! thank you
It works even if vehicle is an abstract class?
GG
You are so brosome :)
Good job, man!