0
How can I ask for the user input after some code runs?
I want to ask the user a question, and get there input BUT only after they have typed for a different question. However Sololearn lumps every single user input into one when they first run the code, so they wont even know what there answering! Thanks for the help. example code: import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Hello how are you?\n\n"); String userInput = scan.nextLine(); System.out.print("\n\nwhats your favorite food?\n\n"); userInput = scan.nextLine(); } }
1 Antwort
+ 1
For that you have to use an interactive console.
SoloLearn does not provide that.
Please search for an online interactive Java compiler on Google