我试图在textview中显示我的摘要结果是否有任何语法除了返回摘要之外使用,因为我得到了一个未识别表达式的错误,我不知道任何其他语法。
//construct the summary size out of select sentences
String summary = "";
summary = summary + "• " + firstSentence + System.getProperty("line.separator") + System.getProperty("line.separator");
for(String sentence : sentences)//foreach string sentence in sentences list
{
if(setSummarySentences.contains(sentence))
{
//produce each sentence with a bullet point and good amounts of spacing
summary = summary + "• " + sentence + System.getProperty("line.separator") + System.getProperty("line.separator");
}
}
return summary;
}
}
答案 0 :(得分:1)
你的错误在以下一行:
TextView textView3 = return summary;
您正在尝试为变量分配return
语句,这不是有效的语法。
请查看Java tutorials,特别是assignment和return部分。