java - keyword 'this' shown as a variable name -
i beginner in java coding , having hard time understanding below scenario. below screen shot of eclipse, while trying debug program. not understand why variables section in top right corner shows this variable name , value of this test(class name). thought pointer , not variable. , moreover, object class test not yet created. so, referencing to? if see screenshot not used in program. still while debugging shown variable name
can me ?
from section 15.8.3 of jls:
when used primary expression, keyword
thisdenotes value reference object instance method or default method invoked (§15.12), or object being constructed.
so can sort of regard read-only variable, basically. can same thing can other variables.
in screen-shot, execution @ start of constructor - this refers object being initialized.
Comments
Post a Comment