//ついでにこれもgetDemand()をオーバーライドしてDemandに入れとくと便利
public int getDemand(int shop, int item){
try {
//ArrayIndexOutOfBoundsExceptionがあるからいらんが...
//demand[][]を再初期化するメソッドを追加したときに備えて例外追加
if(shop > this.shop || item> this.item){
throw new OshietekunException("shop" + this.shop + "以上 item" + this.item + "以上でかい値いれるんじゃねぇよタコ");
} else {
return demand[x][y];
}
} catch(OshietekunException e){
e.printStackTrace();

//RunTimeExceptionなのでいらんかも
} catch(ArrayIndexOutOfBoundsException e){
e.printStackTrace();
} catch(Exception e){
e.printStackTrace();
}
}

//うえ動かすにはこのクラス必要
class OshietekunException extends Exception{
public OshietekunException(String message){
super(message);
}
}