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); } }
3 Respuestas
+ 3
Cause method's name is nextInt(), not NextInt()
remove final
And read about CODE CONVENTION in java
+ 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
0
Thank You so Much 💞 lovey'all