I did wrong explanation . Now I am doing better explanation. My problem is error handling that is not exception. So my code is below. Can I check wit try catch if I dont want to enter non-positive integer for example
import java.util.Scanner;
public static void main(String[] args) {
System.out.println("Type in the expression with no empty spaces: ");
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
String[] tokens = split("[*,/,+,-");
for (int i = 0; i < 1; i++) {
String delims = tokens[1];
double n1 = Double.parseDouble(tokens[0]);
double n2 = Double.parseDouble(tokens[2]);
switch(tokens) case1;"+" System.out.println(n1+n2) // All cases
}
}