The problem
Write a program that displays a random uppercase letter using the Math.random() method.
Breaking it down
public static void main(String[] args) {
char ch = (char) (Math.random() * 26 + 'A');
System.out.println(ch);
}
Output
Z
Write a program that displays a random uppercase letter using the Math.random() method.
public static void main(String[] args) {
char ch = (char) (Math.random() * 26 + 'A');
System.out.println(ch);
}
Z