Here is your issue
num1 = scan.nextLine();
Let's look at what data type num1 is:
int num1;
scan.nextLine()
will return a String. And you can't have int num1 = "1", because they are different data types.
You should use scan.nextInt()
. It will return a number. That'll solve your problems :)
So you'll have num1 = scan.nextInt()
, num2 = scan.nextInt()
, and num3 = scan.nextInt()
.
I hope that helps. Good luck!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…