用ascii码好像没有什么用,我需要按esc退出,好像有键值这个东西,,但是那个好像又涉及到什么监听之类。
package Test;
import java.util.Scanner;
import bullets.Armorbullet;
import bullets.Battery;
import shop.Shop;
import fishs.Fishbin;
import fishs.Pond;
public class Test {
public static void main(String[] args) {
String zz;
char c;
Shop shop1 = new Shop();
Battery battery = new Battery();
Scanner scan1 = new Scanner(System.in);
do {
System.out.println("按任意键开始继续,按esc退出");
c = scan1.nextLine().charAt(0);
shop1.oprate();// 商店列表
System.out.println("请输入您想购买的炮弹名称");
Scanner scan = new Scanner(System.in);
zz = shop1.boom(scan.nextLine());// 购买炮弹
battery.boom(zz);
} while (c != 27);
}
}
慕婉清3593897
相关分类