Java 为什么我的代码会跳过用户输入当前/目标行业的部分?
我的代码:Java 为什么我的代码会跳过用户输入当前/目标行业的部分?,java,Java,我的代码: import java.util.*; public class ScreenCandidates { public static void main (String[] args) { Scanner scan = new Scanner(System.in); //About You System.out.println("\t\tAbout You"); System.out.println(); System.out.print("\nName: "); String
import java.util.*;
public class ScreenCandidates
{
public static void main (String[] args)
{
Scanner scan = new Scanner(System.in);
//About You
System.out.println("\t\tAbout You");
System.out.println();
System.out.print("\nName: ");
String name = scan.nextLine();
System.out.print("\nLocation: ");
String location = scan.nextLine();
System.out.print("\nLanguages: ");
String languages = scan.nextLine();
System.out.print("\nHighest Level of Education: ");
String education = scan.nextLine();
System.out.print("\nGPA: ");
double gpa = scan.nextDouble();
//Your Professional Goals
System.out.println("\t\tYour Professional Goals ");
System.out.print("\nIndustry (current or target): ");
String industry = scan.nextLine();
//Work History
System.out.println("\t\tWork History ");
System.out.println();
System.out.print("\nCurrent Title: ");
String currentTitle = scan.nextLine();
System.out.print("\nCurrent Employer: ");
String currentEmployer = scan.nextLine();
System.out.print("\nPrevious Titles: ");
String previosTitle1 = scan.nextLine();
System.out.print("\nFormer Employer: ");
String formerEmployer = scan.nextLine();
//Qualifications, Skills and Accomplishments
}
}
当我运行代码时:
关于你
姓名:彼得
地点:07430
语言:德语
最高学历:大专学历
平均成绩:3.95
你的职业目标
行业(当前或目标):工作经历
当前标题:Java程序员
现任雇主:Verizon
历届职称:教师
前雇主:Jonas Salk中学在双gpa=scan.nextDouble()之后添加一个scan.nextLine()
通过调用nextDouble()