作业帮 > 综合 > 作业

JAVA里for(int a:b)

来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/09/22 08:26:50
JAVA里for(int a:b)
public class arrs {\x09
\x09 int[] a\x09=\x09{\x0910,1,5,2,4,3,8,7,6,9\x09};
\x09
\x09 for\x09(int b:a){
\x09\x09 System.out.print(b);
\x09\x09 }
}
提示Syntax error on token "for", Identifier expected,
JAVA里for(int a:b)
public class arrs {
static int[] a={10,1,5,2,4,3,8,7,6,9};
public static void main(String[] args){
 for(int b:a){
 System.out.print(b);
 }
}
}
没有主方法你是没有办法测试的