+ 3

Why java compiler is not working well on sololearn

6th Nov 2020, 10:32 AM
Rowdy Reddy
Rowdy Reddy - avatar
18 Answers
+ 7
Your code is perfect Rowdy Reddy I tried on ide and it works exactly as you want. But as mentioned by Benjamin Jürgens in SL playground interactive input are not possible. All your inputs should be given at once so the output will show for once only. Users can only interact in web codes here.
6th Nov 2020, 11:24 AM
Minho
Minho - avatar
+ 14
It's working 😅 Tell the input format Like.. Input : 2 3 4 It will work
6th Nov 2020, 11:10 AM
Aditya
Aditya - avatar
+ 10
Is it showing "Oops something went wrong"
6th Nov 2020, 10:42 AM
Aditya
Aditya - avatar
+ 9
I'm lost now😅 Minho 🇰🇷 up to you 😅😆
6th Nov 2020, 11:18 AM
Aditya
Aditya - avatar
+ 8
Yes then your code works fine..
6th Nov 2020, 11:06 AM
Aditya
Aditya - avatar
+ 7
Can you please share your snippet
6th Nov 2020, 10:46 AM
Aditya
Aditya - avatar
+ 7
The java. util. Scanner. nextInt() method Scans the next token of the input as an int. So split inputs https://code.sololearn.com/c17MEdH7wc5d/?ref=app
6th Nov 2020, 10:54 AM
Aditya
Aditya - avatar
+ 4
Interactivity on sololearn is very limited. You have to provide all input first, one input per line. Your program works if you provide 3 lines if input with numbers but obviously not as intended since the user can't react to the hints
6th Nov 2020, 11:19 AM
Benjamin Jürgens
Benjamin Jürgens - avatar
+ 4
Thank you
6th Nov 2020, 11:25 AM
Rowdy Reddy
Rowdy Reddy - avatar
+ 2
It is showing exception in thread main
6th Nov 2020, 10:44 AM
Rowdy Reddy
Rowdy Reddy - avatar
+ 2
import java.util.*; import java.util.Random; public class Main { public static void main(String[] args) { int i,guess; System.out.println("Guess a number between 0 an 10"); Random generator=new Random(); Scanner sc=new Scanner(System.in); int r=generator.nextInt(11); for (i=0;i<3;i++){ guess=sc.nextInt(); if (guess==r){ System.out.println("right"); break; } else if (guess<r){ System.out.println("too small"); } else if (guess>10){ System.out.println("out of range"); } else if(guess>r){ System.out.println("too big"); } else{ System.out.println("invalid input"); } } } }
6th Nov 2020, 10:49 AM
Rowdy Reddy
Rowdy Reddy - avatar
+ 2
My java code is not working on sololearn but it is working on other apps why??
6th Nov 2020, 11:08 AM
Rowdy Reddy
Rowdy Reddy - avatar
+ 2
Kk
7th Nov 2020, 7:51 PM
Rowdy Reddy
Rowdy Reddy - avatar
+ 1
I wanted to give 3 chances in guessing
6th Nov 2020, 11:00 AM
Rowdy Reddy
Rowdy Reddy - avatar
+ 1
It only asking the input once and giving error after that
6th Nov 2020, 11:13 AM
Rowdy Reddy
Rowdy Reddy - avatar
0
try another
7th Nov 2020, 7:50 PM
JOHN WEST
JOHN WEST - avatar
0
bug
8th Nov 2020, 3:42 AM
Clarence Phol Andino
Clarence Phol Andino - avatar
0
It is an app not a command prompt that we use in computer or personal computer
8th Nov 2020, 9:23 AM
anant singh
anant singh - avatar