I don't see why you want to build those strings there, they won't change and you are only using funny2 in the setPhraseAra method. You could build those random strings in that method instead of trying to build them in the class initialisation (which doesn't work). For instance, you could use this:
You don't even need to convert the ArrayLists to arrays.Code:... public void setPhraseAra(){ int ran1 = (int) (Math.random() * verbs.size()); int ran2 = (int) (Math.random() * adjectives.size()); int ran3 = (int) (Math.random() * nouns.size()); p = a; a = adjectives.get(ran2) + " " + nouns.get(ran3) + " " + verbs.get(ran1); } ...




Reply With Quote