Ok I'm really new to this and am not even sure I'm asking the right question but I want to create an object that has some regualr values like strings and ints etc. But in addition I want one of the properties to be an array of strings like this:
int hp =100;
int level =1;
int exp=0;
String[] items = {"hpPot","blank","blank","blank","blank"};
return new player(level, exp, hp, name, items[] );
}
This doesn't work and at the least I'd like to know exactly why.
Thanks.
player..?"blank"to the items? Unless there's an actual item called "blank", I suggest you don't do this. Either pass innullfor "empty" slots or (probably better) simply pass in an array of just a single element. The actual allocation of storage and checking of the maximum number of items should probably belong to theplayerclass (which should be named ´Player` in accordance to the generally accepted Java Naming Conventions).Player player = new Player().