vendredi 11 novembre 2016

Java Random Class that Outputs Letters (A to E)

So I'm creating a program that output 3 random letters from A to E. The issue is that it should also include lowercase A to E( A,a,B,b,C,c,D,d,E,e)

This is what I used to print out a random letter.

letterValue = (char) (rand.nextInt(5) + 'A');
System.out.print(letterValue);

The variable 'letterValue' should print out A to E, both Uppercase and Lowercase.




Aucun commentaire:

Enregistrer un commentaire