samedi 25 janvier 2020

Random word from a string [duplicate]

public class MadLibs {
    public static void main(String[] args) {

        String color[]={"White", "Yellow", "Blue", "Red", "Green"};
        String pastTenseVerb[]={"accepted", "added", "admired", "admitted", "advised"};
        String adjective[]={"aboard", "boorish", "cooing", "enchanted", "public"};
        String noun[]={"proposal", "uncle", "ladder", "pie", "county"};

        System.out.print("The " + color + " dragon " + pastTenseVerb + " at the " + adjective);
        System.out.println(" knight, who rode in a sturdy, giant " + noun + ".");
    }
}

Hello.I have the code like above and I wonder,is there a way to print a random word from every string.If yes can you give me a solution?




Aucun commentaire:

Enregistrer un commentaire