What's the error in this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's the error in this code?

public class ReadingInput { public static void main (String [] args) { int FirstNumber; int SecondNumber; Scanner kb = new Scanner(System.in); System.out.println("please enter first number"); FirstNumber = kb.NextInt(); System.out.println("please enter Second number"); SecondNumber = kb.NextInt(); double average = (FirstNumber + SecondNumber )/ 2.0; System.out.println("the average is:" + average ); } }

10th Oct 2018, 7:53 PM
hend kandil
hend kandil - avatar
2 Answers
+ 2
import java.util.Scanner; Put ^ at the top of the program.. Second, change both of your NextInt() to nextInt() Lowercase n
10th Oct 2018, 8:17 PM
LordHill
LordHill - avatar
+ 1
thanks Rick👍
11th Oct 2018, 12:33 PM
hend kandil
hend kandil - avatar