I kept on receiving error(cannot find symbol) in (Firstnum = Di.NextInt(); and Secondnum = Di.NextInt();) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I kept on receiving error(cannot find symbol) in (Firstnum = Di.NextInt(); and Secondnum = Di.NextInt();)

import java.util.Scanner; class MyClass { public static void main(String[ ] args) { int Firstnum; int Secondnum; final int Sum=Firstnum+Secondnum; Scanner Di= new Scanner(System.in); System.out.print("First Number:"); Firstnum = Di.NextInt(); System.out.print("Second Number:"); Secondnum = Di.NextInt(); System.out.println(Sum); } }

10th Sep 2019, 11:21 PM
Rodgin P. Misterio
Rodgin P. Misterio - avatar
3 Answers
+ 3
Cause method's name is nextInt(), not NextInt() remove final And read about CODE CONVENTION in java
10th Sep 2019, 11:34 PM
Marina Vasilyova
Marina Vasilyova - avatar
+ 3
The methods name is nextInt, not NextInt. The final int sum doesn't work that way also because the point of making a variable final makes it not able to change if you want to make sum a final number you need to put it at the end of when you get first and second number out of the Scanner here is how I would code your code hope this helps https://code.sololearn.com/cWnkLpp0xv3A/?ref=app
10th Sep 2019, 11:36 PM
Stuart Moss
Stuart Moss - avatar
0
Thank You so Much 💞 lovey'all
11th Sep 2019, 12:06 AM
Rodgin P. Misterio
Rodgin P. Misterio - avatar