我是 linux 中的 java 编程,但它报告以下错误。有人可以帮我吗?感谢期待!
Break.java:4: ';' expected
for (int x:numbers) {
^
Break.java:11: illegal start of expression
}
^
2 errors
public class Break {
public static void main(String args[]) {
int [] numbers={10,20,30,40,50};
for (int x:numbers){
if (x==30){
break;
}
System.out.print(x);
System.out.print("\n");
}
}
}