错误: 非法的表达式开始

zgzhlnbyl 2014-03-26 11:05:19
求救,已经弄了两天了,整个程序都没问题,就是最后红字标注的地方出现问题,所以不能运行。按理来说语法是对的,到底错在哪儿?请高手修改一下。谢谢谢谢!


public static void main(String[] args) throws Exception {

Dictionnaire dico= Dictionnaire.getInstance();

Collection<String> etiquettes;
List<Collection> lemmes= new Vector<Collection>();

for(Syntagme mot:List<Syntagme>) // 错误: 非法的表达式开始
{
etiquettes= new Vector<String>();
etiquettes.addAll(dico.getTags(mot.toString()));
lemmes.add(etiquettes);
System.out.println("Découpage : "+ Syntagme);
}
System.out.println("Lemmatisation : "+lemmes);

}
...全文
885 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
机器学习之禅 2014-03-27
  • 打赏
  • 举报
回复
///////////////像这样的 List<Syntagme> tempSyn = new ArrayList<Syntagme>(); for(Syntagme mot:List<Syntagme>) { .............. }
机器学习之禅 2014-03-27
  • 打赏
  • 举报
回复
for(Syntagme mot:List<Syntagme>) List<Syntagme>这是一个类型定义,不能作为循环判定。 你要用它生成一个实体列表,用来作为被循环体
lliiqiang 2014-03-27
  • 打赏
  • 举报
回复
被循环对象呢?
铁匠梁老师 2014-03-26
  • 打赏
  • 举报
回复

		String[] array = {"a","b","c"};
		for(String every:array){
			System.out.println(every);
		}
S117 2014-03-26
  • 打赏
  • 举报
回复
那么用当然是错误的了,你去看看怎么用foreach循环把!

List<Collection> lemmes= new Vector<Collection>();
for(Collection c : lemmes ){
}
foreach的语句格式: for(元素类型t 元素变量x : 遍历对象obj){ 引用了x的java语句; }

62,615

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧