A little help? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

A little help?

I've made a question like this before. I probably made a few mistakes. But anyway, I want the user to input their "height" (it doesn't really make sense but I wanted to test it out) Then, it would respond by either saying "That's Great!" Or "Too Bad!" Depending on the number they input. But for some reason it doesn't work. I have just started to get back into Java, so I might be rusty, I just need a little help https://code.sololearn.com/c1lbkbRL3XKu/?ref=app

8th Feb 2020, 3:20 AM
Cesar Morales
Cesar Morales - avatar
2 Answers
+ 4
That is not how you take an input in Java. Also, you can't compare strings to integers. If you can't remember next time, please review the course before asking, because everything is well explained there. https://code.sololearn.com/cxc55bl6bZs7/?ref=app
8th Feb 2020, 3:24 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
0
both of these input methods work int height = new java.util.Scanner(System.in).nextInt(); int height = Integer.parseInt(sc.nextLine());
8th Feb 2020, 4:44 AM
BroFar
BroFar - avatar