Java Video Tutorial 14

preview_player
Показать описание


In this Java video tutorial I cover Polymorphism, Inheritance, Protected, Final, Instanceof and a bunch more.
Рекомендации по теме
Комментарии
Автор

I love Derek's lectures. Only one suggestion - Include the subject in the title, e.g. "Java Tutorial 13 - Interface & Abstract Class". In this way, people can go directly to the tutorial that they are interested. Thanks.

wenzhongmo
Автор

Probably the best way someone has ever explained Polymorphism... ! Great Job .. Sir. Derek Banas

suhasc
Автор

Sorry about that. I actually have temporarily lost control of this video because of a false copyright claim that was made against it. Because of that I'm not able to edit it in any way. Did you know the music industry can make copyright claims even though you don't have music in your videos? Now you do :)

derekbanas
Автор

That was proably the best explanation of "protected" that I heard.

dragonore
Автор

Leave me any questions and I'll be happy to help

derekbanas
Автор

The Best Explanation of Protected, Final and Polymorphism I have EVER seen <3

peshawabarznjii
Автор

You use them to protect your data when others use your code. You also use private to force users to enter proper data. Let's say you have age. You wouldn't want someone to be able to directly access a variable and give it the value of 'A' for it. So you force them to use a function like setAge and verify that they entered a number

derekbanas
Автор

I like how you are straight to the point. Man, the world needs more people like Derek Banas in it! Keep up the videos. America's college professors should be more like you. And high school teachers

UltraTechStudio
Автор

Each object you create will have its own value in the field name. Let us say another variable is named name. You show that you are referring to the object field name by proceeding it with this. If you create a method that provides a calculation, return will return the answer of that calculation when it is done. Does that help?

derekbanas
Автор

Thank you :) Always feel free to ask questions. I answer all of them eventually

derekbanas
Автор

Thank you very much :) I constantly try to improve. I'm very happy that you are enjoying the videos

derekbanas
Автор

Yes this is pretty much the biggest Java tutorial anyone have made on youtube so far. The tutorial actually continues in my Design Patterns, Refactoring, Object Oriented Design and now Android tutorials. I'll be making Java tutorials until I've covered everything.

derekbanas
Автор

I have a website that people are free to post on. I also monitor YT constantly through the day. Always feel free to ask questions. I'll answer them

derekbanas
Автор

You can access statics by creating an object that then has access to the static. The reason why you access static methods in a static way is so future people who see that the method is static to prevent errors. I cover this in more detail in the first 2 videos of my design patterns tutorial

derekbanas
Автор

Thank you :) You should use static variables when you want objects of a class to share the same variable values. So if object 1 changes the value it will also change for object 2, 3, etc. I provide numerous examples as the tutorial continues. I also talk a lot about it in the first 2 videos in my design pattern video tutorial. I hope that helps. Always feel free to ask questions

derekbanas
Автор

It doesn't have to be protected. Protected means it is accessible only by objects in its own package or by a subclass of its class in another package.

derekbanas
Автор

Yes polymorphism allows you to group like classes under a super class type. Then an object can inherit those superclasses that work and overwrite those that don't. The compiler is smart enough to use the proper methods though. There are numerous other reasons why it is useful which I'll cover as the tutorial continues

derekbanas
Автор

Make sure you created both Animal, Cat and LessonFourteen. You also must save them in the same folder

derekbanas
Автор

The Cat can override anything in Animal. The constructor is used to assign values to fields (initialize) when an object is created from a class. Since Cat may have new fields plus the ones in Cat that is why Cat needs its own constructor. There is a default constructor that is used if you don't make one that just doesn't set anything. The default constructor in Animal is called as well when Cat is created. I cover this topic in many ways as the tutorial continues

derekbanas
Автор

Thank you :) I appreciate the compliment. I haven't used X Code much lately because all of my work is in Android development. I will definitely cover iOS sometime though. I just have so much more experience with Android that I want to cover that first.

derekbanas