OOP | this & super

Watcharin Pongsuwan
Jackiiz
Published in
1 min readAug 3, 2018
image credit : https://saixiii.com/java-programming/

“this”

is keyword to call Attribute and Method of Class

syntax : this.ชื่อ Attribute

this จะเรียกในคลาสลูกก่อน หากคลาสลูกไม่มีจะไปเรียกในคลาสแม่เลย

“this” กับ constructor

syntax : this(parameter list);

“super”

syntax : super.ชื่อ attribute

Super จะเรียกในคลาสแม่เลย

--

--