ERROR : finished with non-zero exit value 1

  android, android-studio, java, user-input

Actually, I’m doing a simple task in java that is getting input from the user and adding the value and showing the output but I’m getting an error which I don’t understand what is for
here is the error

Process ‘command ‘D:/Android Studio/jre/bin/java.exe” finished with non-zero exit value 1

and here is the code

import java.util.Scanner;

public class MyClass {
    public static void main(String[] args) {

        Scanner sc= new Scanner(System.in);    //System.in is a standard input stream
        System.out.print("Enter first number- ");
        int a= sc.nextInt();
        System.out.print("Enter second number- ");
        int b= sc.nextInt();
        int total=a+b;
        System.out.println("Toatl is = " + total);

    }
}

Source: Android Questions

LEAVE A COMMENT