Calling Code From Other Classes (Beginner)
Hi Im a begginer with Java so no complex code etc
Basically to avoid my code from getting too long i want my user to input a
choice and then i have a bunch of for and elese's for what happens if they
enter a certain phrase, e.g.
if(choice.equals("Fight")) {
//Grab code from fight.java/fight.class
}
else
{
if(choice.equals("Train")) {
//Grab code from train.java/train.class
}
else
so on and so forth for two other possible inputs. I just need to know how
to call external code so it doesn't get too cluttered.
Thanks if anyone has a sugestion please can you also tell me where to put
the code and stuff.
Also if amnyone has a beter idea than the for, elses inside each other
that would be reat :D
No comments:
Post a Comment