zizi21
asked on
toString method
Hi,
In the java classes, is it common to write this.variable in the toString method when you are overriding it. Why is "this" written? You are able to access the variable without this.
i.e
public class test{
private String a;
@Override
public String toString() {
return this.a;
}
}
In the java classes, is it common to write this.variable in the toString method when you are overriding it. Why is "this" written? You are able to access the variable without this.
i.e
public class test{
private String a;
@Override
public String toString() {
return this.a;
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER