java程序设计,用scanner编写,输入姓名,性别,年龄,住址,婚否,可以输出相应的数据
展开全部
Scanner s = new Scanner(System.in);
System.out.print("请输入姓名:");
String name = s.next();
System.out.print("请输入性别:");
String sex = s.next();
System.out.print("请输入年龄:");
String age = s.next();
System.out.print("请输入住址:");
String address = s.next();
System.out.print("请输入是否已婚:");
String isMarried = s.next();
System.out.println("姓名:" + name + ",性别:" + sex + ",年龄" + age + ",住址:" + address + "婚否:" + isMarried);
System.out.print("请输入姓名:");
String name = s.next();
System.out.print("请输入性别:");
String sex = s.next();
System.out.print("请输入年龄:");
String age = s.next();
System.out.print("请输入住址:");
String address = s.next();
System.out.print("请输入是否已婚:");
String isMarried = s.next();
System.out.println("姓名:" + name + ",性别:" + sex + ",年龄" + age + ",住址:" + address + "婚否:" + isMarried);
展开全部
....是输出 你输入的数据 还是要进行什么处理
追问
输入一个学生的姓名这些,然后可以输出这些数据
追答
Scanner sc = new Scanner(System.in);
String[] title = {"姓名","性别","年龄","住址","婚否"};
String[] info =new String[5];
for (int i = 0; i < info.length; i++) {
System.out.println("请输入"+title[i]+":");
info[i]=sc.next();
}
System.out.println("输入完毕");
System.out.print("输入的信息: ");
for (int i = 0; i < info.length; i++) {
System.out.print("["+title[i]+":"+info[i]+"]");
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询