Question: In the code below, setName ( ) uses the keyword this to explicitly refer to the [ Select ] variable that is shadowed by the
In the code below, setName uses the keyword this to explicitly refer to the
Select
variable that is shadowed by the
Select
variable.
public class Account
private String name;
Method to set the name in the object.
public void setNameString name
this.name name; Store the name.
Method to retrieve the name from the object.
public String getName
return name; Return value of name to caller.
END CLASS Account
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
