首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >为什么我的代码跳过用户输入当前/目标行业的部分?

为什么我的代码跳过用户输入当前/目标行业的部分?
EN

Stack Overflow用户
提问于 2015-08-14 15:38:19
回答 1查看 19关注 0票数 0

我的代码:

代码语言:javascript
运行
复制
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
}
}

当我运行代码时:

关于你

姓名: Peter

地点: 07430

语言:德语

最高学历:副学士学位

GPA: 3.95你的职业目标

行业(当前或目标):工作历史记录

当前标题: Java程序员

现任雇主: Verizon

前职称:教师

前雇主: Jonas Salk中学

EN

回答 1

Stack Overflow用户

发布于 2015-08-14 15:40:11

double gpa = scan.nextDouble();之后添加一个newline,以获取调用nextDouble()留下的newline

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32013769

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档