In my app, I have a class called Monsters that reads in data from an XML file. This Monster class calls another class called MonsterStats.
Monster uses data from the XML file to set variables in the MonsterStats class.
Is there a way to use these variables in another class?
Monster.java
public class Monster {
public MonsterStats monsterStats;
...processXML pseudo code...
monsterStats.name = xml.monsterName;
monsterStats.type = xml.monsterType;
monsterStats.race = xml.monsterRace;
...etc...
}
MonsterStats.java
public class MonsterStats {
//encounter info
public String name = "";
public String type = "";
public String race = "";
public String gender = "";
public String alignment = "";
public int age = 0;
}
someOtherClass.java
public class someOtherClass {
//how can I access the variables in MonsterStats
// that were just set by Monsters???
}
Here is skeleton implementation.