I am a beginner in java and trying to create a program that recieves input numbers in terminal, and will continuously ask for a new numbers until 0 is entered. After 0 has been entered I want the program to summarize all of the numbers and plus them together. But when I try to compile the program I get this error:
Heres the code:
import java.util.Scanner;
public class SumTall {
public static void main(String[] args) {
Scanner tallscanner = new Scanner(System.in);
int tall = 0;
int tall1;
System.out.println("Write a number:");
tall1 = Integer.parseInt(tallscanner.nextLine());
while(tall1 > 0) {
System.out.println("Write another number:");
tall1 = Integer.parseInt(tallscanner.nextLine());
int tall2 = tall + tall1;
}
if(tall1 == 0) {
System.out.println(tall2);
}
}
}