programmingex4 25 java

Solutions on MaxInterview for programmingex4 25 java by the best coders in the world

showing results for - "programmingex4 25 java"
Oskar
11 Nov 2019
1public class ProgrammingEx4_25 {
2 
3 public static void main(String[] args) {
4  //Randomly picking the letters 
5  //ASCII code for A-Z is 65-90
6  char letter1 = (char) ((int)(Math.random()*26+65));
7  char letter2 = (char) ((int)(Math.random()*26+65));
8  char letter3 = (char) ((int)(Math.random()*26+65));
9   
10  int numbers =  (int)(Math.random()*10000);
11  //Zeros padding using format method
12  String sNumbers = String.format("%04d" ,numbers );
13   
14  System.out.println("The plate number is " + letter1 + letter2 +letter3 + sNumbers);
15   
16 
17 }
18 
19}
20
similar questions
queries leading to this page
programmingex4 25 java