+ 1

Why not working in SoloLearn but working in Idea?

Why not working in SoloLearn but working in Idea? When I use this code I get :Exception in thread "main" java.util.NoSuchElementException: No line found at java.base/java.util.Scanner.nextLine(Scanner.java:1651) at AnimalCall.main(AnimalCall.java:12) but in Idea no problem with it import java.util.Scanner; public class AnimalCall { public static void main(String[] args) { System.out.println("Please enter animal type! Only the introduction optionare accepted: cow, dog, cat, mouse or c, d, ca, m"); Scanner sc = new Scanner(System.in); int check = 0; while(check >= 0) { String s = sc.nextLine(); if(s.equals("c") || s.equals("C") || s.equals("cow") || s.equals("Cow") || s.equals("COW")) { System.out.println("MMMMMMMOOOOOOWWWWWW!!!!!!!!"); break; } if(s.equals("d") || s.equals("D") || s.equals("dog") || s.equals("Dog") || s.equals("DOG")) { System.out.println("WOOOOOOFFFFFFF!!!!!!!!"); break; } if(s.equals("ca") || s.equals("Ca") || s.equals("CA") || s.equals("cat") || s.equals("Cat") || s.equals("CAT")) { System.out.println("MMMMMMMHHHEEEOOOOWWWW!!!!!!!!"); break; } if(s.equals("m") || s.equals("M") || s.equals("mouse") || s.equals("Mouse") || s.equals("MOUSE")) { System.out.println("SQWWWWIIIIRLLL!!!!!!!!"); break; } else { if(s.equals("stop") && check > 0) { break; } System.out.println("Please enter the type of animal correctly or write stop"); if(check > 100) { check = 1; } check++; } } } }

13th Dec 2018, 7:42 PM
Imperium
3 ответов
+ 7
Works fine friend! ;)👍😉 With SL compiler you don't need to prompt the user for input!! 😊 https://code.sololearn.com/cS7B9lNb30ev/?ref=app
13th Dec 2018, 7:48 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 4
😆 Imperium You are welcome!👍 Have a nice Coding! ;) 😉
13th Dec 2018, 8:16 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 2
Thank you!
13th Dec 2018, 8:03 PM
Imperium