論理演算子「!」を使用することは可能ですか?trueまたはfalseの値を保持するオブジェクトで?特にこのようなオブジェクトのために?
public class Briefcase {
private final double amount;
private final String model;
private boolean removed = false;
private String face;
public Briefcase(double amount, int face, String model) {
this.face = Integer.toString(face);
this.amount = amount;
this.model = model;
}
public double getAmount() {
return amount;
}
@Override
public String toString() {
return face;
}
public String getModel() {
return model;
}
public void remove() {
removed = true;
face = "X";
}
public boolean isRemoved() {
return removed;
}
}
次に、このように使用します
Briefcase[] cases = new Briefcase[];
if (!cases[5].isRemoved()) { .... block of code}
それは可能ですか?もしそうなら、そのドキュメントと他のいくつかの例へのリンクを私に提供してください、私はこれが同時に面白いと思います