I am trying to pull a random string from an ArrayList. I make sure to populate it before pulling from it yet it still acts as if it empty. I even printed the list out after populating it and it is indeed populated, leaving me to believe the problem must be elsewhere in my code. Any ideas?
Oh, and yes, my code is hilarious. I'm creating a console game for fun about a gross dude who works in my office. (Might as well make practice fun, right?) Enjoy. :P
here is the object class
import java.util.ArrayList;
import java.util.Random;
public class Meg {
private String name = "Meg";
private int weight = 300;
private int annoyanceLevel = 1000;
static ArrayList<String> randomBoringTopics = new ArrayList<String>();
public static void populateRandomBoringTopics(){
randomBoringTopics.add("women's underwear");
randomBoringTopics.add("men with backhair");
randomBoringTopics.add("tucked in shirts");
randomBoringTopics.add("shaving at one's desk");
randomBoringTopics.add("pot bellies");
}
public void Fart(){
System.out.println("Meg let's out a huge fart with zero consideration for who hears it");
}
public static void startBoringConversation(){
Random randomGenerator = null;
int index = randomGenerator.nextInt(randomBoringTopics.size());
String randomBoringTopic = randomBoringTopics.get(index);
System.out.println("Meg begins to talk to you about his thoughts regarding " + randomBoringTopic);
}
public void creep(){
System.out.println("Meg suddenly appears behind you, breathing heavily and rubbing his stomach while fingering his belly button");
}
public void interject(){
System.out.print("Meg hears you talking and butts into your conversation, making it instantly boring");
}
public void disappear(){
System.out.print("Meg leaves his desk and is gone for an extended period of time, relieving those in his row but "
+ "tormenting the rest of the office");
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getWeight() {
return weight;
}
public void setWeight(int weight) {
this.weight = weight;
}
public int getAnnoyanceLevel() {
return annoyanceLevel;
}
public void setAnnoyanceLevel(int annoyanceLevel) {
this.annoyanceLevel = annoyanceLevel;
}
}
And here is my main...
public class Main {
public static void main(String args[]){
Meg.populateRandomBoringTopics();
Meg.startBoringConversation();
}
}