【发布时间】:2013-01-03 14:45:46
【问题描述】:
首先让我说,我确实尝试过用谷歌搜索这个,但我不确定我在寻找什么。我知道我可以使用 setter 方法,但有没有办法直接访问这些字段?
List<String> token = new ArrayList<String>();
List<String> lemma = new ArrayList<String>();
List<String> pos = new ArrayList<String>();
tt.setHandler(new TokenHandler<String>() {
@Override
public void token(final String token, final String pos, final String lemma) {
this.token.add(token); // cannot be resolved or is not a field
this.lemma.add(lemma); // cannot be resolved or is not a field
this.pos.add(pos); // cannot be resolved or is not a field
}
});
你能帮帮我吗?!
谢谢!
鲍勃
【问题讨论】:
-
删除
this访问权限,就像token一样 -
在你的函数中,这是 TokenHandler 的实例。它没有这 3 个变量。
-
这可能有助于您理解问题:stackoverflow.com/questions/5107158/…
标签: java