Connect with a community that values knowledge and expertise on IDNLearn.com. Get the information you need from our community of experts who provide accurate and comprehensive answers to all your questions.
Answer:
Explanation:
In order to ask for and accept an input in Java you first need to import the Scanner class into your file. Once you have imported this class you then need to create a Scanner object and assign it a variable. Next you would need to print to the system the question that you want the user to input an answer to. Lastly, you save the input into a string variable to use for later. An example of which can be seen in the following code...
Scanner input = new Scanner(System.in);
System.out.println("Enter an answer: ");
String answer = input.nextLine();