public String foodstats (){
String foodstats = "";
for ( int i = 0; i < consumables.size(); i++){
foodstats = "Name: " + consumables.get(i).getName() + "\tNutrition: " + consumables.get(i).getNValue() + "\tStamina: " + consumables.get(i).getStamina() + "\n" ;
}
return foodstats;
}
So this returns: Name: Water Nutrition: 30 Stamina : 15
I realize why its doing this, the second time the for loop runs through it replaces the first item's stats and returns only the replaced stats.
Is there a way around this? I need to return all the item's stats based on the array list size.
+=instead of=. (But my mind-reading skills are a little off today.)List<String>instead of aString.