public void putsInts ( int... argsss){
for (int i : argsss) {
System.out.println(i);
}
}是这样吗?
但是我的eclipse报错呀..Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
Syntax error, insert ";" to complete LocalVariableDeclarationStatement
void is an invalid type for the variable putsInts
Syntax error on tokens, delete these tokens
argsss cannot be resolved...

解决方案 »

  1.   

    什么特殊字符?我把argsss换成别的不行,试过了,用javac直接编译也试过了,不行,也不是eclipse的问题.
    全程序在这里:
    public class hello {
    /**
     * @param args
     */
    public static void main(String[] args) {
    // TODO Auto-generated method stub
    public void putsInts (int... Intes){
    for (int i : Intes) {
    System.out.println(i);
    }

    putsInts (1, 2, 3);
    }
    }
    这里是报错
    Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
    Syntax error, insert ";" to complete BlockStatements
    void is an invalid type for the variable putsInts
    Syntax error on tokens, delete these tokens
    Intes cannot be resolved
    The method putsInts(int, int, int) is undefined for the type hello at hello.main(hello.java:9)JDK版本1.6.0_04
      

  2.   

     你在main函数里面定义putInts函数?public   class   hello   {public   void   putsInts   (int...   Intes){
      for   (int   i   :   Intes)   {
        System.out.println(i);
      }
    }  /**
      *   @param   args
      */
    public   static   void   main(String[]   args)   {
    //   TODO   Auto-generated   method   stub
      putsInts   (1,   2,   3);
    }} 
      

  3.   

    必须使用JDK1.5以后的版本才可以,这个特性在1.5才加入的