Java Math random character generate

Description

Java Math random character generate

public class Main {
  public static void main(String[] args) {
    // Generate a random number between 65 and 90
    int number = 65 + (int)(Math.random() * (91 - 65));

    // Display a random uppercase letter
    System.out.println((char)(number));
  }/*from  w w  w.j a  v a 2  s. c  o m*/
}



PreviousNext

Related