java布尔值初始为false_当我使用||时,我的布尔值计算为FALSE或者和/和JAVA

那个部分

static boolean isBagFull = ((!Bag.itemSlot1.equals("Empty"))||(!Bag.itemSlot2.equals("Empty"))||(!Bag.itemSlot3.equals("Empty"))||(!Bag.itemSlot4.equals("Empty"))||(!Bag.itemSlot5.equals("Empty")));总是变得错误!请帮忙!虽然我检查了所有itemSlots,它们都是“空的”

static Bag bag = new Bag();

static String helmet = "";

static String chestplate = "";

static String leggings = "";

static String boots = "";

static boolean isBagFull = ((!Bag.itemSlot1.equals("Empty"))||(!Bag.itemSlot2.equals("Empty"))||(!Bag.itemSlot3.equals("Empty"))||(!Bag.itemSlot4.equals("Empty"))||(!Bag.itemSlot5.equals("Empty")));

public void removeArmour(String s, int b){

if (b==1&&!helmet.equals("")) {

if (!isBagFull){//ITS USED HERE GUYS!!!!!!!!!!!!!!!!!! HELP!!!!!

bag.newItem(s);

helmet = "";

}else{

JOptionPane.showMessageDialog(null, "You do not have any room to remove the "+s);

}

}else if (b==2&&!chestplate.equals("")){

if (!isBagFull){

bag.newItem(s);

chestplate = "";

}else{

JOptionPane.showMessageDialog(null, "You do not have any room to remove the "+s);

}

}else if (b==3&&!leggings.equals("")){

if (!isBagFull){

bag.newItem(s);

leggings = "";

}else{

JOptionPane.showMessageDialog(null, "You do not have any room to remove the "+s);

}

}else if (b==4&&!boots.equals("")){

if (!isBagFull){

bag.newItem(s);

boots = "";

}else{

JOptionPane.showMessageDialog(null, "You do not have any room to remove the "+s);

}

}else if (b>=5||b<=0){

JOptionPane.showMessageDialog(null, "Sorry you don't have the correct position!", "ERROR", 0);

JOptionPane.showMessageDialog(null, "Helmet = 1 \n Chestplate = 2 \n Leggings = 3 \n Boots = 4", "Armour Numbers", 0);

}else{

JOptionPane.showMessageDialog(null, "You ar not wearing anything there!");

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值