Java程序未提示用户

时间:2018-10-01 09:22:54

标签: java input prompt

import java.util.Scanner;
public class insuranceEstimate{
public static void main(String[]args){

    Scanner user_input=new Scanner(System.in);


    String gender;
    System.out.print("If you are female enter 'female', or if you are male enter 'male': ");
    gender=user_input.next();

    int age;
    System.out.print("Enter your age: ");
    age=user_input.nextInt();

    int accidentFree;
    System.out.print("How many years accident-free are you?");
    accidentFree=user_input.nextInt();

我的代码提示用户输入性别,然后在输入时不要求年龄或无事故年龄,它的语法与我编写的类似程序完全相同,语法完美。

0 个答案:

没有答案