package com.whxiong.work08;
import java.util.InputMismatchException; import java.util.Scanner; import org.apache.log4j.Logger;
public class Work08 { private static Logger logger = Logger.getLogger(Work08.class.getName());
/** * @param args */ public static void main(String[] args) { Scanner input = new Scanner(System.in); String[] name = new String[4]; String[] sex = new String[4]; for (int i = 0; i < 4; i++) { System.out.print("请输入第" + (i + 1) + "位学员的姓名:"); name[i] = input.next(); System.out.print("请输入第" + (i + 1) + "位学员的性别:"); sex[i] = input.next(); if (!"男".equals(sex[i]) && !"女".equals(sex[i])) { logger.debug("学员性别输入错误!"); logger.debug("请输入正确的学员信息!"); return; } } if (name[3].equals("魏海雄") && sex[3].equals("男")) { logger.debug("学员姓名输入成功!"); logger.debug("***您输入的学员信息如下***"); logger.debug("四位学员姓名:"); for (String name1 : name) { logger.debug(name1); } logger.debug("四位学员性别:"); for (String sex1 : sex) { logger.debug(sex1); } }else{ logger.debug("第四位学员信息输入错误,请重新输入!"); } }
}