-1

I experimented with java code that expected user input. However, I am unable to type anything in the Visual Studio Code Editor's designated space. To fix this issue, I installed the Java Development Pack Extensions, but nothing worked.

import java.util.Scanner;

public class App {
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);
    int age;

    System.out.println("Enter age:");
    age= sc.nextInt();
    
    
  }
}

I used Visual Studio Code editor to try and get user input; normally, I use Intellij Idea editor. As a result, I am unable to type anything on the console to provide input when using the Visual Studio Code Editor to write Java programs. So, please offer your assistance in finding a solution.

2
  • 1
    Did you take a look at this question? I am not familiar with VS code, but it seems to be same problem. Commented Aug 31, 2023 at 13:09
  • thank you for your assistance I did it that way and now it works well Commented Aug 31, 2023 at 13:27

1 Answer 1

2

I suggest you to check the official website of Visual Studio Code editor about this topic.

Link to the topic

Especially the part:

Debug session inputs The default Debug Console in VS Code doesn't support inputs. If your program need inputs from a terminal, you can use the Integrated Terminal (Ctrl+`) within VS Code or an external terminal to launch it. You can also use the user setting java.debug.settings.console to configure a global console for all Java debug sessions.

Part can be useful for you. Good luck!

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.