do
{
System.out.print("输入年份:");
reader.hasNextInt();
TestYear = reader.nextInt();
Istrue = true;
if ((TestYear > 10000) || (TestYear < 2009))//判断有效年数;
{
System.out.println("\n请输入有效数据!");
Istrue = false;
}
if (Istrue)
{ break; } }
while (!Istrue);
NowYear = TestYear;
Istrue = false; if (Istrue) { break; } while (!Istrue);这四部分分别是什么意思呀 请大家帮忙呀 急用呀
{
System.out.print("输入年份:");
reader.hasNextInt();
TestYear = reader.nextInt();
Istrue = true;
if ((TestYear > 10000) || (TestYear < 2009))//判断有效年数;
{
System.out.println("\n请输入有效数据!");
Istrue = false;
}
if (Istrue)
{ break; } }
while (!Istrue);
NowYear = TestYear;
Istrue = false; if (Istrue) { break; } while (!Istrue);这四部分分别是什么意思呀 请大家帮忙呀 急用呀
do{
System.out.print("输入年份:");
reader.hasNextInt();
TestYear = reader.nextInt();
Istrue = true;
if ((TestYear > 10000) || (TestYear < 2009)){ //年份无效设置为标记数为false并提示循环输入
System.out.println("\n请输入有效数据!");
Istrue = false;
}
if (Istrue){ break; } // 如果输入的结果正确,退出输入参数的循环 }while (!Istrue); //输入参数错误时一直提示输入正确的,直到正确退出 NowYear = TestYear; //赋值年份
不知道是不是你的意思