java scanner 的一个小程序。。。
在这项小程序中,要使用Scanner,会提示和读取用户细节在以下顺序:FullnameAgeNationality程序应该输出的信息格式如下:Pleaseenteryou...
在这项小程序中,要使用Scanner,会提示和读取用户
细节在以下顺序:
Full name Age Nationality
程序应该输出的信息格式如下:
Please enter your full name: Jack Black
Please enter your age: 55
Please enter your country of birth: Malaysia
Hi Jack Black,
You're 55 and born in Malaysia.
Nice to meet you!
Bye.
把code给我 谢谢啊。。。 展开
细节在以下顺序:
Full name Age Nationality
程序应该输出的信息格式如下:
Please enter your full name: Jack Black
Please enter your age: 55
Please enter your country of birth: Malaysia
Hi Jack Black,
You're 55 and born in Malaysia.
Nice to meet you!
Bye.
把code给我 谢谢啊。。。 展开
1个回答
展开全部
Scanner input = new Scanner();
System.out.print("输入名字");
String name=input.nextLine();
System.out.print("输入年龄");
String age = input.nextLine();
System.out.print("输入出生地");
String born =input.nextLine();
System.out.println("Hi"+name);
System.out.println("You're"+age+"and born in " +born);
System.out.println("Nice to meet you!");
System.out.println("Bye");
这样做是害了你。。。。这么简单的code都不会?学程序就是要多动手。
System.out.print("输入名字");
String name=input.nextLine();
System.out.print("输入年龄");
String age = input.nextLine();
System.out.print("输入出生地");
String born =input.nextLine();
System.out.println("Hi"+name);
System.out.println("You're"+age+"and born in " +born);
System.out.println("Nice to meet you!");
System.out.println("Bye");
这样做是害了你。。。。这么简单的code都不会?学程序就是要多动手。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询