标题:do while的使用问题
取消只看楼主
zq1983
Rank: 1
等 级:新手上路
帖 子:110
专家分:0
注 册:2006-4-27
 问题点数:0 回复次数:1 
do while的使用问题

import java.io.*;
class solary
{

public static void main(String[] agrs)throws IOException

{

char oper;



do
{
System.out.println("1.删除");
System.out.println("2.修改");
System.out.println("3.查询");
System.out.println("4.添加");
System.out.println("0.推出");

System.out.print("请输入选择:");
oper=(char)System.in.read();
switch(oper)
{

case '1':
System.out.println("sdsdsdsd");
break;
case '2':
System.out.println("dkfkj");
break;
case '3':
System.out.println("dfdfdfdf");
break;
case '4':
System.out.println("bbbbbbb");
break;
default:
System.out.println("输入错误");
}

}
while(oper!='0');
}

}
这个程序可以运行,但是我输入一个数字以后,他把那个界面给我打出来3次,不知道是为什么。要是没听懂,运行一下就知道那里不对了

搜索更多相关主题的帖子: void 查询 public import 
2006-12-04 18:07
zq1983
Rank: 1
等 级:新手上路
帖 子:110
专家分:0
注 册:2006-4-27
得分:0 

谢谢了,明白了
2006-12-04 20:42



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-107238-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.148512 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved