0
So in java, we use scanner because using this, we dont have to initialize in program, we can take inputs. Is that correct?
https://code.sololearn.com/cmvIus3z0t85/?ref=app This is not working.
8 Réponses
+ 2
Yes the Scanner class is used to take user input and the variable which is going to hold a value assigned by the Scanner need not be initialized before hand.
Because there is no point doing that.
+ 1
You are taking both inputs in num1.
Change the 2nd one to num2.
+ 1
Your code is not working because you declare num1 twice. Line 9 should be: int num2 =...
Also when printing the result, you are actually multiplying. To add the numbers put them in parentheses, otherwise they are just concatenated to the text: (num1 + num2)
0
Oh yes
0
I copy paste that, and forgot to correct😅😅
0
And someone answer my question please.
0
Ira Sarkar kindly change that num1 * num2 to num1+num2 and observe the result just like Tibor Santa mentioned.