【发布时间】:2014-12-01 01:44:54
【问题描述】:
基本上,我希望此代码仅在物品 textBooks 在库存中时执行,现在它一直执行。我不知道该在 if 语句中添加什么,因为我所做的一切只是使 currentMessage 等于其先前的值。
public void read(){
boolean found = myArray.contains("textBooks");
currentMessage = "sorry you cannot read this text book because you are not the all knowing";
}
【问题讨论】:
-
你试过监听器了吗?
-
不,我没试过
-
我会在库存上设置一个监听器,每次库存内容更改时都会运行此代码...
标签: java if-statement arraylist boolean