是否可以创建一个类并具有一个 String ... 属性,该属性可以使用尽可能多或尽可能少的字符串?示例:请原谅我粗略的伪代码,这是针对 java 的。
//this is the method:
public void getXXXX(String ...) {
//random code executes in a loop with as many as strings that are inputted
}
//this code calls it
getXXXX("Benjamin","Jordan","Steve")
getXXXX("Pengu","No")
getXXXX("hi")