Section 8.4 Referring to the Current Object’s Members with the this Reference

• An instance method of an object implicitly uses keyword this (p. 322) to refer to the object’s instance variables and other methods. Keyword this can also be used explicitly.

• The compiler produces a separate file with the .class extension for every compiled class.

• If a local variable has the same name as a class’s field, the local variable shadows the field. You can use the this reference in a method to refer to the shadowed field explicitly.

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.