java - why no reference variable used to add method in awt -
i going through awt first time in java, found how create button in creating object button - instance b1 - , add component container using add method [add(b1)] . in case noticed was, add() method of parent class may container has been inherited, , button b1 directly added without having reference calling method add() ( .add() ) , petty confusing me. how method called without using dot operator?
if method belongs object in, either directly or through inheritance parent, don't have prefix method anything. can use
add();
if want clear, can use this
keyword specify method belongs object in. work same above:
this.add();
Comments
Post a Comment