Java Tutorial 18 - 'this' Keyword

preview_player
Показать описание
In this Java tutorial, you will know what "this" keyword actually does.
Рекомендации по теме
Комментарии
Автор

Thank you - only person ever to explain and use correct analogy for the keyword "THIS". You described it beautifully and makes perfect sense

nh
Автор

very well explained, keep it up 👍👍👍🙂🙂🙂

SmartProgramming
Автор

@cronnin You could just replace the constructor with a method e.g. public void setValues(int x, int y){...}. And then use the this command. "this" helps you to say ... listen compiler: with x i mean this x form the private variables and not the parameter of the consturctor or the setValues(int x, int y) method.

MrYouMath
Автор

Excellent tutorial. I learned a few things here..

TheFlyguy
Автор

@cronnin you will either need a constructor or a method in order to understand the this keyword

MrAbIRaZ
Автор

thanks! now i realised that this is referring to the global variable

MrMarkgyuro
Автор

basically the compiler thought you were referring 'x' as an object

cubmichaels
Автор

You should use eclipse not Notepad++ as with eclipse you can just run it and it outputs it in a console window so you don't need to bother with cmd :)

physicsimpossible
Автор

its confusing me when you create both the object name and the method name both same.. that is tutorial...i do not understand what what made you do that

nikhil
Автор

so to summarize. is it true to say that we use .this when we have 2 vaiables with the same name???

garbo
Автор

ie. it wouldn't print because x wasn't a t.object until it was referred as an object with the this. keyword

cubmichaels
Автор

This is actually referring to the method's variables.

thebigbang
Автор

yes.... :) i am also coming from bucky vid. :)

syednayyar
Автор

thumbs up if comment from bucky's video brought here, , and u are determined to clear the confusion caused by his video.

daDfarSpanTaistheKin
Автор

Can't anyone explain 'this' without using constructors?!

cronnin
join shbcf.ru