当我在我的代码中使用Scanner时,我的程序只处于运行状态,而没有完成。

huangapple go评论58阅读模式
英文:

When i use Scanner in my code then my program only in running state it not completed

问题

每当我在这个程序中使用Scanner时,程序进入运行状态但没有完成,如果完成了,那么它的输入就不起作用。但是当我将它移除后,它可以成功运行。我不知道在我的VSCode中发生了什么事情。首先,我尝试了Scanner,但它不起作用,然后我移除了Scanner并手动输入了数字,然后它起作用了。

英文:

Whenever i use Scanner is this program, the program goes to running state it is not completed, if it is completed then its input not working. But when i remove it successfully working. I don't know what happening in my vscode.enter image description here

Firstly i tried Scanner but its not working then i remove scanner and manually entered number then its worked.'

答案1

得分: 1

屏幕截图显示您正在使用Code Runner执行脚本,现在它在OUTPUT面板中输出结果,但OUTPUT面板无法接受输入。

  • 您可以添加以下设置,使结果输出到TERMINAL面板
"code-runner.runInTerminal": true,
  • 最佳解决方案是使用官方的Java扩展包来执行脚本。

当我在我的代码中使用Scanner时,我的程序只处于运行状态,而没有完成。

当我在我的代码中使用Scanner时,我的程序只处于运行状态,而没有完成。

请使用Run Java代替Run Code

英文:

The screenshot shows that you are using Code Runner to execute the script, and now it outputs the result in the OUTPUT panel, but the OUTPUT panel cannot accept input.

  • You can add the following setting to make the result output in the TERMINAL panel

        "code-runner.runInTerminal": true,
    
  • The best solution is to use the official java extension package to execute the script.

    当我在我的代码中使用Scanner时,我的程序只处于运行状态,而没有完成。

    当我在我的代码中使用Scanner时,我的程序只处于运行状态,而没有完成。

    Run Java instead of Run Code

huangapple
  • 本文由 发表于 2023年6月26日 02:01:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/76551772.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定