August 12, 201510 yr I want it to withdraw food from this array public static String[] food = { "Shrimp","Trout","Salmon","Tuna","Lobster","Swordfish","Monkfish","Shark" }; im calling it this way and (may not be the best way but is an example) if (s.bank.isOpen()){ //do banking if (!s.inventory.contains(food)){ if (s.getBank().contains(food)){ s.bank.withdrawAll(food); } } } and i get this error i tried fixing it with intelj but this does not work Edited August 12, 201510 yr by Sinatra
August 12, 201510 yr I want it to withdraw food from this array public static String[] food = { "Shrimp","Trout","Salmon","Tuna","Lobster","Swordfish","Monkfish","Shark" }; im calling it this way if (s.bank.isOpen()){ //do banking if (!s.inventory.contains(food)){ if (s.getBank().contains(food)){ s.bank.withdrawAll(food); } } } and i get this error i tried fixing it with intelj but this does not work You are passing an array to a method that only takes a String parameter. Possible solution: for(String f; food) { if(!getBank().contains(f)) continue; else { getBank().withdrawAll(f); break; } }
August 12, 201510 yr Author You are passing an array to a method that only takes a String parameter. Possible solution: for(String f; food) { if(!getBank().contains(f)) continue; else { getBank().withdrawAll(f); break; } } hmm okay ill work with this and thanks for the fast response
August 12, 201510 yr Slow stepping. Find item using item container. Item item = Bank.getItem (food); Bank.withdrawAll(item.getName ()); Just do a null check on the item. hmm okay ill work with this and thanks for the fast response You are passing an array to a method that only takes a String parameter. Possible solution: for(String f; food) { if(!getBank().contains(f)) continue; else { getBank().withdrawAll(f); break; } }
August 12, 201510 yr Author Slow stepping. Find item using item container. Item item = Bank.getItem (food); Bank.withdrawAll(item.getName ()); Just do a null check on the item. you are who they say you are java guru
Create an account or sign in to comment