首页 > 代码库 > 'for each' statements are only available if source level is 5.0

'for each' statements are only available if source level is 5.0

在用foreach的时候,出现以下错误:

错误:Syntax error, ‘for each‘ statements are only available if source level is 5.0

解决方法:

1.查看安装JDK的版本,发现是1.8版本,jdk安装没有问题

2.查看一下eclipse,发现用的也是1.8版本的,

3.看编译环境,发现是1.4的,修改过来后,解决

  

'for each' statements are only available if source level is 5.0