在我的情况下,该类将有两个构造函数,它们都将 3 个字符串作为参数,但是要在其中一个构造函数中初始化的字符串变量之一可能会有所不同。是否可以执行以下操作:
class A {
String x = null;
String y = null;
String z = null;
String a = null;
A(String x, String y, String z) {
....
}
A(String a, String y, String z) {
....
}
}