假設(shè)一個車牌號碼由三個字母和四個數(shù)字組成?
public class Hello {
public static void main(String[] args) {
char c1 =(char)(int)(Math.random()*26+65);
char c2 =(char)(int)(Math.random()*26+65);
char c3 =(char)(int)(Math.random()*26+65);
int x1=(int)(Math.random()*10);
int x2=(int)(Math.random()*10);
int x3=(int)(Math.random()*10);
int x4=(int)(Math.random()*10);
System.out.print(c1);
System.out.print(c2);
System.out.print(c3);
System.out.print(x1);
System.out.print(x2);
System.out.print(x3);
System.out.print(x4);
}
}