Putting randomized classes that run when you run another class
Ok, so i'm trying to make a random phrase generator, such as you run the class, and it pulls and runs other classes.
I have a few premade text classes, pretty much just the basic "hello world!" class, with different texts. i'm trying to use this for a joke randomizer, as i'm still learning basic java, but i thought this would be a useful method to learn
Re: Putting randomized classes that run when you run another class
You may be confusing data with code as I don't see where multiple classes come in here as you're using them. Yes, I see you creating a Joke class and a JokeTeller class, but that's about it. The jokes themselves are data, are written in a text file or database on disk. Then the JokeTeller class would read in the data, create Joke objects from the data and place these Joke objects into an ArrayList of Joke , declared as ArrayList<Joke>. But you wouldn't create a new class for each joke.