Will someone please help me finish my first sololearn program using scanner? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Will someone please help me finish my first sololearn program using scanner?

really simple program help https://code.sololearn.com/cImHDSTypFMo/?ref=app

12th Jun 2018, 5:15 PM
LottoMan
3 Answers
+ 4
Honestly, my list turned into a lot of stuff that was wrong. lol Mostly a bunch of syntax issues, and then some logic issues as well. When you're done, go through the Java course again so you can further solidify your learning of the language. https://code.sololearn.com/cMQ62cGcDwQE/#java import java.util.Scanner; class Program { public static void main(String[ ] args) { int max = 0; Scanner value = new Scanner(System.in); System.out.println("Enter 1st integer:"); int a = value.nextInt(); System.out.println("Enter 2nd integer:"); int b = value.nextInt(); max = getMax(a, b); System.out.println("Max = " + max); } public static int getMax (int a, int b) { if (a>b){ return a; } else { return b; } } } ^It's based on your code. Just compare/contrast the two and you'll see what you did wrong. Also, and this is very important, READ THE ERROR MESSAGES when you go to run/compile. It tells you what's wrong and where, so then you know where to investigate and resolve.
12th Jun 2018, 5:36 PM
Fata1 Err0r
Fata1 Err0r - avatar
0
I forgot to import Scanner. Error on line 8 and 13 with scanner still though after import. There is an error with variable value (scanner). Donna or Fata 1 Err0r, if you live in DFW area plea$e let me know.
12th Jun 2018, 6:18 PM
LottoMan
0
I got my 1st SL project to work! I was trying to figure out what was wrong with my value scanner. The error messege was pointing to the dot of the call to nextInt() method. The problem was I forgot to put the () after nextInt. Thanks to my two contributors. I will go through the java course again.
13th Jun 2018, 2:50 PM
LottoMan