VA関数(パラメータ可変関数)(JAVAのポイントはどういう意味ですか)
1000 ワード
2011年8月3日16:04:25
今日codeを見た
@Override
final protected LotteryResponse doInBackground(Void... params)
{
//code
}
質問:この点はどういう意味ですか.
回答:
自分の例を参観する
public class TestVariousArgMethod {
public static void main(String arg[])
{
gen sample = new gen();
sample.show("china","america");
sample.show("china","america","1","2","3");
}
}
/** sample class with a various arguments method*/
class gen{
/** main logic method ,put the various arguments to screen*/
public void show(String...strings)
{
for(String str:strings)
{
System.out.print(str+"\t");
}
}
}
パラメータ可変method、使用時にparamsの配列が得られ、so easy!......^^