首页 > 代码库 > Java开发中经典的小实例-(while(参数){})
Java开发中经典的小实例-(while(参数){})
import java.util.Scanner;
public class Test_while {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input=new Scanner(System.in);
/*int sum=0;
int score=0;
int count=0;
String choose="yes";
while(choose.equals("yes")){
System.out.println("请输入学生成绩:");
score=input.nextInt();
sum=sum+score;
System.out.println("是否继续输入:(yes/no)");
choose=input.next();
count++;
}
System.out.println("总分是:"+sum);
System.out.println("平均分是:"+sum/count);*/
String anw="no";
while(anw.equals("no")){
System.out.println("令狐冲练独孤九剑....");
System.out.println("问师傅练得怎么样?");
anw=input.next();
}
System.out.println("找小师妹玩。。。");
}
}
Java开发中经典的小实例-(while(参数){})