java for loop choice

来源:互联网 发布:中国网络行政学院 编辑:程序博客网 时间:2024/05/16 19:33
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class RunTest {
public static void main(String[] args) throws IOException {
while(true){
System.out.println("There are three choice :1 2 3");
System.out.println("Please Enter your choice:");
BufferedReader br = new BufferedReader(new InputStreamReader(
System.in));
String name = br.readLine();
if( "1".equals(name)){
System.out.println("Your choice is 1");

}
if ("2".equals(name))
{
System.out.println("Your choice is 2");
}
if ("3".equals(name))
{
System.out.println("Your choice is 3");
}
}




}
}
原创粉丝点击