为什么这台扫描仪不接受println上的输入?

时间:2015-08-18 18:44:17

标签: java java.util.scanner

当我的应用程序编译时,它不会接受roomNum在其要求的同一行上的输入,"请输入要搜索的房间:"

System.out.println();
if(roomNum < 0);   
{
    System.out.println("Please enter a room to search for: ");
    roomNum = input.nextInt();
}

如果我只使用next代替nextInt,则无法正确编译。

上面的代码有效,但不会接受同一行的输入,这是我需要的功能。

1 个答案:

答案 0 :(得分:2)

两件事:在failed to expand tokens for [Artifact filename:ear::version] java.lang.NullPointerException at org.jvnet.hudson.plugins.repositoryconnector.aether.Aether.convertHudsonNonProxyToJavaNonProxy(Aether.java:151) at org.jvnet.hudson.plugins.repositoryconnector.aether.Aether.addProxySelectorIfNecessary(Aether.java:139) at org.jvnet.hudson.plugins.repositoryconnector.aether.Aether.newSession(Aether.java:183) at org.jvnet.hudson.plugins.repositoryconnector.aether.Aether.resolve(Aether.java:189) at org.jvnet.hudson.plugins.repositoryconnector.ArtifactResolver.download(ArtifactResolver.java:129) at org.jvnet.hudson.plugins.repositoryconnector.ArtifactResolver.perform(ArtifactResolver.java:101) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779) at hudson.model.Build$BuildExecution.build(Build.java:205) at hudson.model.Build$BuildExecution.doRun(Build.java:162) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537) at hudson.model.Run.execute(Run.java:1741) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:381) Build step 'Artifact Resolver' marked build as failure Finished: FAILURE 条件后删除分号,如果想在同一行上输入,请使用if