#4.4 Java Tutorial | This keyword

preview_player
Показать описание
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
Рекомендации по теме
Комментарии
Автор

why i don't get this playlist at the start of my semester, such a wonderful playlist watching before my end semester exam, crystal clear examples in less than 5 min (on average).
Superb work done . I really wanna thank u for your amazing work, ..KEEP IT UP.

anushreevirtualgaming
Автор

Thank you, very much,
Finally Understood after watching this video only.

KcClips
Автор

Mi explanatin chala clear ga undi, thank you so much

yjy
Автор

I watched many videos for this keyword concept...but this is very clear and easy to understand...thanks sir

onecreation
Автор

I am currently in class 9, but too ahead of my classmates only in coding and I don't think that my teacher will support me in that because she is kind of stick to the syllabus person . so I wanted to know that is your youtube java playlist enough to learn java completely . (most probably you won't respond but it will be nice if you you do)

himanshupoonia
Автор

Thanks for clearing my so confused 'This ' keyword

indianidea
Автор

Easily the best example and explanation of this. Thanks so much!

steviesoprano
Автор

Sir, pls suggest me which book is useful for spring and hibernate

omi
Автор

Finally I got the mean of this keyword

vishakhaagarwal
Автор

What if we don't use *obj.* in line 25 and 26 and simply write num1 and num2 respectively

sadhgurusfunniestandwittie
Автор

So the this keywords simply just assures the instance variables?

jongmagee
Автор

Sir, first constructer we don't use any parameters

kumaraddanki
Автор

we are calling the calc with parameters 4, 5 with respect to num1 and num2 which are local, then how the output is zero instead of 4 and 5. can some explain pls?

reddyrajanaveen
Автор

there different uses of this keyword in java. Can you please explain all the uses of this keyword.

myanarocky
Автор

I saw this keyword is being used as a method in java. Any explanations?

Thecrow
Автор

Sir what happened with servlet nd jsp series

myprofile
Автор

Hello sir can you explain what is instance of class.

TheHardik
Автор

Hi Sir, my doubt is, why we are not using this keyword inside the main() method ?

sengottaiyanperiyasamy