0
Getting input
Could you send me an example code "how to get input from the user, please? I received one explanation yesterday how to do it. I tried but it's not working. Here is the code: import java.util.Scanner; class MyClass { public static void main(String[ ] args) { Scanner obj=new Scanner (System.in); String name; System.out.println("Enter your name"); name=obj.nextLine(); System.out.println("Yor name is="+name); } }
4 Answers
+ 3
Your code is also working fine. If you're trying it on Sololearn, you need to provide your input on that alert box and hit the submit.
+ 3
Where are you running the code ? Code works
https://code.sololearn.com/cb7fjqjVvVgO/?ref=app
+ 2
Mario,
For next time please specify the language relevant to the question (and code) in the tags â
For the sake of context clarity ..
0
I'm running code on "Sololearn app"