关于#java#的问题,请各位专家解答!

img

你看看

Scanner scan = new Scanner(System.in);
        log("请录入嫦娥个人信息:");
        String name = null, age = null, sex = null, weight = null, addr = null, marry = null;
        while (true) {

            if (name == null) {
                log("请输入姓名:");
                name = scan.nextLine();
                continue;
            }
            if (age == null) {
                log("请输入年龄:");
                age = scan.nextLine();
                continue;
            }
            if (sex == null) {
                log("请输入性别:");
                sex = scan.nextLine();
                continue;
            }
            if (weight == null) {
                log("请输入体重:");
                weight = scan.nextLine();
                continue;
            }

            if (addr == null) {
                log("请输入地址:");
                addr = scan.nextLine();
                continue;
            }
            if (marry == null) {
                log("请输入是否已婚:");
                marry = scan.nextLine();
                continue;
            }
            log("信息如下:");

            String tmp = scan.nextLine();
            if (tmp.contains("exit")) {
                break;
            }

        }

        scan.close();

输入打印就好