Could someone take a look at my code and let me know what is wrong with it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Could someone take a look at my code and let me know what is wrong with it?

I am trying to integrate a few concepts into one program, including utilizing user input with the Scanner class, the if statement, and an else statement. https://code.sololearn.com/cyQX2y1D9JsU/?ref=app

1st Mar 2019, 4:57 AM
Alfredo Trujillo
Alfredo Trujillo - avatar
2 Answers
+ 2
myNum doesn't actually hold the value of the user's input. You can use myNum.nextInt() for that. For example: int x = myNum.nextInt(); if (x >= 0) { // Do something } else { // Do something }
1st Mar 2019, 5:35 AM
Diego
Diego - avatar
+ 1
Wow, gracias vato! Me encanta que otro persona de Mexico esta interesado en el codigo. Soy de California pero mis padres vienen de Mexico. I am very excited to know there are other people from Mexico interested and actively participating in programming! Thanks again, brother! https://code.sololearn.com/cyQX2y1D9JsU/?ref=app
1st Mar 2019, 6:02 AM
Alfredo Trujillo
Alfredo Trujillo - avatar