Ai
1 Star 0 Fork 0

spring299792/JAVA学习

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
forwhile.java 792 Bytes
一键复制 编辑 原始数据 按行查看 历史
spring299792 提交于 2020-03-04 15:31 +08:00 . 初始学习
import java.io.*;
public class forwhile{
public static void main(String[] args) throws IOException {
char ch;
System.out.println("按1/2/3可得大奖");
System.out.println("按空格后再按回车键可退出循环操作");
while ((ch = (char) System.in.read()) != ' '){
System.in.skip(2);
switch (ch) {
case '1':
System.out.println("奖品1");
break;
case '2':
System.out.println("奖品2");
break;
case '3':
System.out.println("奖品3");
break;
default:
System.out.println("没有中奖");
}
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/spring299792/java_study.git
git@gitee.com:spring299792/java_study.git
spring299792
java_study
JAVA学习
master

搜索帮助