Java Tutorial - This keyword and This Method

preview_player
Показать описание
This tutorial talks about using this keyword and this method in constructor overloading in Java.
Рекомендации по теме
Комментарии
Автор

Just re-watched. Wow...you're an incredible teacher. Why can't everyone just say what this is like you did. It's a way for the JRE to distinguish between a class property and a parameter in a constructor or mutator that is being used to initialize or change it. You are a Java guru. Thx again.

ryandavis
Автор

You just earned another sub xD
thank you so much, i finally understand what the "this" keyword and method are. Kudos!

ericlareza
Автор

Moreover, we use the this(); in constructors in Java to make all constructors call only one constructor so that we don't have to repeat our logic. There are tutorials I have created on constructors and overloaded constructors. I am not sure if you have watched those. Also, there is an 8-part tutorial on Object Oriented Programming example.

ProfessorSaad
Автор

The usage of this keyword is done only inside a constructor which has the same names for local parameters and class non-static properties. The statements above are the three unique calls from main or any other caller to the constructor. You can call constructor with hardcoded values or through parameter. Parameter name of the caller makes no difference it is only on the called side, which is the constructor where we will be forced to use the this keyword if the parameter and property name match

ProfessorSaad
Автор

I just understood this for the first time...I think haha. Thank you, and very good video. Please post more. I will follow your channel.

ryandavis
Автор

This is an awesome tutorial, thanks! :P

anilmawji