我見過的語法和它接近的將數組作爲參數傳遞給方法簽名的替代語法是什麼?
形式public void foo(Object object1, Object ...){}
有誰知道確切的語法或有一個鏈接到更多信息?
我見過的語法和它接近的將數組作爲參數傳遞給方法簽名的替代語法是什麼?
形式public void foo(Object object1, Object ...){}
有誰知道確切的語法或有一個鏈接到更多信息?
在Java中它被稱爲可變參數。
public void foo(Object object, Object... objects) {
// the 'objects' argument is an array here.
}
你幾乎擁有了,
public void foo(Object object1, Object... objects){}
也許你正在尋找this?
Java "params" in method signature?
可能是你在找什麼。
是的,我的是重複的。 – user511202 2011-02-24 18:35:13
很酷,並不積極。 – Orbit 2011-02-24 18:37:20