vendredi 21 août 2020

How can I get Random Character from User Input and Store the Random Characters to Array?

public static void main(String[] args) {

    String[] array = new String[4];
    System.out.println("Type 3 Strings:");
    Scanner input = new Scanner(System.in);// User input

    for (int i = 0; i < 3; i++) // used for loop for user input

    {
        array[i] = input.nextLine(); // Assigned users value to array
    }
    System.out.println("Your Strings are:");
    System.out.println(array[0]);
    System.out.println(array[1]);
    System.out.println(array[2]);
}

Now I want to find a random character set from array, the Random characters are also maximum (input string length-1). Then store the Random characters into another Array. What to do next Please help me.




Aucun commentaire:

Enregistrer un commentaire