filmov
tv
#4.4 Java Tutorial | This keyword

Показать описание
After the constructor, we will learn about This Keyword.
-This keyword is a reference variable that refers to the current object.
- This keyword is to remove the confusion between class attributes and parameters that have the same names.
- Using this(), we can invoke the current class constructor.
- Using this keyword, we can return the current class instance.
- This keyword can also be used as a parameter of a method.
- This keyword tells that the variable is an instance, not local variable.
- This keyword will be used with the dot operator(.) with variables.
Difference between this and this () in Java:
-This refers to the current object while this () refers to the constructor with matching parameters.
-The keyword ‘this’ works only with objects.
-The call “this ()’ is used to call more than one constructor from the same class.
In this video we will see :
- this keyword
- Need for this keyword
- Example of this keyword
- shadowing
More Learning :
Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20
-This keyword is a reference variable that refers to the current object.
- This keyword is to remove the confusion between class attributes and parameters that have the same names.
- Using this(), we can invoke the current class constructor.
- Using this keyword, we can return the current class instance.
- This keyword can also be used as a parameter of a method.
- This keyword tells that the variable is an instance, not local variable.
- This keyword will be used with the dot operator(.) with variables.
Difference between this and this () in Java:
-This refers to the current object while this () refers to the constructor with matching parameters.
-The keyword ‘this’ works only with objects.
-The call “this ()’ is used to call more than one constructor from the same class.
In this video we will see :
- this keyword
- Need for this keyword
- Example of this keyword
- shadowing
More Learning :
Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20
Комментарии