本人见到
public void setError(Enum errorType, String... errStr)
其中String... 不明白什么意思String怎么能跟点...

解决方案 »

  1.   

    String... errStr means this method can accept one String as its parameter, or two, or three. Anyway, it means uncertain.
      

  2.   

    ...
    省略号
    那是说参数列表里String个数不定
      

  3.   

    String... 
    jdk 5 的新特性。相当于后面可以输入多个string参数。其实也就是相当于一个String[]
      

  4.   

    用一个String[] 来得更实在啊
      

  5.   

    public void setError(Enum errorType, String... errStr) 
    后面那个参数表示变长参数,你可以输入多个string类型的值,相当于一个数组.不过这个参数必须放在最后.因为放在前面的话,如果后面又跟了同类型的参数,编译器无法识别你输入的值到底输入哪个参数.
      

  6.   


    public class Main {
        public static void main(String[] args) {
            test("hello");
            test("hello","world");
            test("hello","world","china");
        }
        public static void test(String...args){
            for (int i = 0; i < args.length; i++) {
                System.out.print(args[i]+"  ");
            }
            System.out.println();
        }
    }