4.16 (Random character) Write a program that displays a random uppercase letter using the Math.random() method.
public class ProgrammingEX4_16 { public static void main(String[] args) { int n = (int) (65 + Math.random() * 26); char c = (char) n; System.out.println("The random letter is " + c); } }
No comments :
Post a Comment