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...
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...
全程序在这里:
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
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);
}}