As per my experience , the Interactivity that you wan't in your code is not possible in sololearn app for languages like java, c++,c etc. input is taken before running the code ,code runs at their server and then the output is displayed on the screen.
Follow these steps to run your code in command line.
1. Write your code in a text file and save it with .java extension and save .
2. Now set the path of command line to the directory in which you have saved your file.
3. Write this code in commnd line.
javac filename. java.
4. Now write .
Your code should run.
In the above instructions filename is the name by which you have saved your java file.
In the steps mentioned above. I am expecting you to know how to change working directory in command line.