E
EdUarDo
Hi all,
Inspecting some pieces of code from someone I found things like this:
class A {
private String id = "";
public A() {
super();
}
public A(String id) {
this.id = id;
}
}
class B extends A {
public B() {
this(""); <-------------------- HERE!
}
public B(String id) {
super(id);
}
}
Inside constructor B() it's calling a constructor. Could this cause some collateral or strange problems?
I know it's nonsense because id attribute it's being initialized by default to "", but I'd like to know if
also is a problem.
Inspecting some pieces of code from someone I found things like this:
class A {
private String id = "";
public A() {
super();
}
public A(String id) {
this.id = id;
}
}
class B extends A {
public B() {
this(""); <-------------------- HERE!
}
public B(String id) {
super(id);
}
}
Inside constructor B() it's calling a constructor. Could this cause some collateral or strange problems?
I know it's nonsense because id attribute it's being initialized by default to "", but I'd like to know if
also is a problem.