用java实现生成车牌号码这个程序的答案,如下所示
package nameyu;public class Test { public static void main(String[] args) { // TODO Auto-generated method stub char ch1=(char) (65+Math.random()*26); char ch2=(char) (65+Math.random()*26); char ch3=(char) (65+Math.random()*26); String str1=String.valueOf(ch1); String str2=String.valueOf(ch2); String str3=String.valueOf(ch3);//把字符转换为字符串 intnumber1=(int) (Math.random()*10); intnumber2=(int) (Math.random()*10); intnumber3=(int) (Math.random()*10); intnumber4=(int) (Math.random()*10);//String str=str1+str2+str3; System.out.println(str1+str2+str3+" "+number1+number2+number3+number4); }}
页:
[1]