0

私は以下のようなクラスを持ってabcいます

public class Abc<T> {
 int arg1;
 int arg2;
 int arg3;

  public <T> Abc(int arg1 , int arg2 ,int arg3){
   this.arg1 = arg1;
   this.arg2 = arg2;
   this.arg3 = arg3;
  }

 public <T> Abc(int arg1, int arg2){

 // How to call the above the constructor by setting some value to arg3.
 }
 }

2引数コンストラクターから3引数を呼び出すにはどうすればよいですか?

4

1 に答える 1

2

このような:

public <T> Abc(int arg1, int arg2){
    this(arg1, arg2, 0);
}

arg3上記で使用した のデフォルト値を定義する必要があります0

注:これらすべては必要ないと思います<T>

于 2013-10-09T05:07:33.060 に答える