Use an array of pokemon
In main()
pokemon[] trainer = new pokemon[6];
trainer[0] = new pokemon();
trainer[0].name = "pikachu";
//...
//trainer[1] .. Till 5
And opponent
could be
class opponent{
String name;
pokemon[] pokes; }
You can set them similarily as trainer
Edit: As I have my own pokemon game, just wanted to clear you concept a bit more.
Create a class pokemons
which contain name , hp , etc of all pokemons. Change the pokemon
class to rather take only one object of pokemons
i.e.,
class pokemon{
pokemons info ; }
In the pokemon
class you can add other things like nick name, current power ,exp
3
solved Pokemon java program, making a team? Array maybe?