is these outputs are correct. or whether the first output will be "hello".
this class will let me to understand the "this" keyword forever.
and another question, is it possible to write the constructor name only as instead of ?
thank you guys.
I'm sorry, but I couldn't understand your question/request.
when in doubt - just merge, and never rebase
posted 2 weeks ago
Liutauras Vilda wrote:I'm sorry, but I couldn't understand your question/request.
i will try to explain by myself and would like you to correct me if i'm wrong:
we use the "this" keyword to referred to the local variable-(the variable which is the attribute of an object)
lets take this example:
Please Tell me if my output answers will be true if will run it.
i know that i can just check it by myself and check whether it works or not, but i want to understand the principal behind the "this" keyword, and not this specific question.
"this" does not refer to a "local" variable.
"this" refers to an instance variable, aka "field", aka "member variable".
A "local" variable has a scope limited to the block that contains it. Once the block exits a local variable disappears though it may persist if a reference to it has been copied to a variable outside the code block.