我有一个类似于String.format(String, Object...)的签名的函数。 我想打电话从JRuby的这个功能没有最后的参数(因为它是可选的),但我的代码引发ArgumentError(wrong # of arguments(1 for 2)) 有没有办法来调用只有1论点就像这个功能我会在Java中做什么?
toString方法我有一个可变参数的构造是这样的: public class Sentence {
public String[] str;
public Sentence(Object... text){
StringBuilder sb = new StringBuilder();
for (Object o : text) {
简单的问题,如何使此代码工作? public class T {
public static void main(String[] args) throws Exception {
new T().m();
}
public // as mentioned by Bozho
void foo(String... s) {
Syst