0
Can anyone give me an example of multiple this statements in a class?
Can anyone give me an example of multiple this statements in a class?
9 Answers
+ 3
Then let's take the second code example...
public MyClass(int age, String name) {
this.age = age;
this.name = name;
}
public MyClass(String name) {
this(0, name);
}
public MyClass(int age) {
this(age, "unknown user");
}
It's to avoid redundant code.
+ 2
What do you describe as a 'this-statement'?
public String getFullName() {
return this.surname + " " + this.familyName;
}
or...
public MyClass(int age, String name) {
this.age = age;
this.name = name;
}
or something different...?
0
swim,multiple this statement means many this() statements in a single class,we use this() in a single class and super() in different classes
0
Sandra Meyer,its not this keyword,its this() statement,like super statement
0
this() without any parameters doesn't make sense from my point of view.
0
Sandra meyer,I am just asking for a example of a program with this() statement,this() can include parameters
0
Not synchronized... đ