Java Video Tutorial 7

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


In this part of my Java Video Tutorial I show you how to create classes in Java.

I cover Java fields (class variables) and methods (functions) first. I then explain what a private field is in detail. We then move on to what it means to overload a method, what a constructor is and how to overload a constructor.
Рекомендации по теме
Комментарии
Автор

Thank you so very much :) You'll never know how happy these nice heartfelt messages mean to me! Thank you for taking the time to write them. Always feel free to ask questions. I'll do my best to always be here to help.

derekbanas
Автор

You're very welcome. If you ever get stuck on anything feel free to ask questions. If part 8 or 10 is confusing feel free to skip them. I approach that info in a different way later in the tutorial

derekbanas
Автор

You're very welcome. Yes always trust the code on the site. I triple check it. Also watch out for parts 8 thru 10. They are on logic and don't feel that you need to understand everything. If some things don't make sense, just skip them and move on. Always feel free to ask questions

derekbanas
Автор

Thank you :) Feel free to leave questions and I'll do my best to help

derekbanas
Автор

I just did that to demonstrate method overloading. One version of setHealth excepts ints while the other excepts doubles. If anything is confusing in this specific part of the tutorial, don't worry about it. I cover everything again in the later parts

derekbanas
Автор

Thank you for taking the time to write such a nice message :) I greatly appreciate it! I'll continue making Java tutorials until I feel that I have covered most everything. I'm very happy that you are enjoying them

derekbanas
Автор

Yes you could definitely do that. If you can think of the steps you take to solve a problem you can create an automated program that can solve any problem

derekbanas
Автор

Thank you for watching :) I really appreciate it

derekbanas
Автор

I think it's awesome how you took a monster, and gave it all these attributes that I can actually understand. I'm a slow learner, and I'm trying to get ahead for my game dev class this year. I never fully understood some of the things you did in earlier tutorials until I rewatched and focused. This time around, I got exactly what you were saying, because you related it to something I know about. Like the monsters health. Instead of giving a percentage of myPI or something along those lines, you took into account how you could relate to your audience. And I think that is just amazing. Thank you for your efforts, and I still can't get over how these videos were posted years ago and you reply to comments in hours. ( Slow Claps, Faster Claps, THE CROWD GOES WILD FOR DEREK) But yea seriously, thanks mate.

AZAGENT
Автор

I'm very happy to help :) feel free to ask questions

derekbanas
Автор

Thank you :) Most of my videos are twice as long before editing. So if you watch a 20 minute video, you are actually getting 40 minutes of content. I love to cram as much information into each video as possible. It will help to print out the code and take notes as you watch. That seems to work best for everyone. I have never been compared to Stanford before. Thank you :)

derekbanas
Автор

Thank you :) That just comes from practice. I've made almost 450 videos at this point. I constantly listen to what you guys tell me and work that into the tutorials. Believe me my first tutorials were terrible

derekbanas
Автор

Thank you :) this tutorial covers everything as it progresses and everything makes sense eventually. You make fields (variables) private so that the setters can make sure the data is valid. You wouldn't want a word saved in age for example. I hope that helps

derekbanas
Автор

The default is similar to protected except that subclasses aren't able to access anything with the default operator, or no operator at all. I cover this stuff as the tutorial continues. It may actually confuse you to think about this stuff so early on

derekbanas
Автор

You can create multiple methods (functions) with the same name as long as the parameters sent to it are different. Then if they send an int it goes to the method that excepts ints and the same goes for the method that excepts doubles

derekbanas
Автор

I think I put to many things in this tutorial. Feel free to watch the tutorials with the monster stuff passively. I recover all of this stuff in later tutorials. This was the only part of the tutorial that I didn't particularly like. It gets much better after part 10

derekbanas
Автор

Links to the code can always be found under the video in the description / underbar

derekbanas
Автор

Yes this is like a call to the objects constructor. this is a shorthand way to reference what ever the current object is. You'll see more ways it is used later.

derekbanas
Автор

It sounds like what you want to do is store information in a database or maybe just a file. I cover that around the 31st video. Eventually I start making real programs, but I have to get the basics out of the way first. My Android tutorial which is written using java is nothing but apps from the very first video. I hope that helps

derekbanas
Автор

A double is just a number with a decimal. If you call a function the code inside of that function is executed. When all of the code is finished executing in the function return is called. Then the code that immediately follows the function call is executed. Does that help

derekbanas