Java实现抽奖功能

导入Java . util . scanner;

公共B类{

公共静态void main(String[] args) {

string chars = " abcdefghijklmnopqrstuvwxyz ";

char nletter = chars . charat((int)(math . random()* 26));

Scanner scanner =新扫描仪(system . in);

char输入;

字符串c;

做{

System.out.println("猜字母(a-z)!"" );

c = scanner . next();

input = c . charat(0);

if(input & gt;nletter){

System.out.println("大猜想!");

} else if(input & lt;nletter){

System.out.println("小猜想!");

}

}while(输入!= n letter);

system . out . println(" Bingo "+n letter);

}

}