Java String to complete mathematical sum
问题 In java, I am currently in the process of trying to find a way to do mathematical sums by typing in text to a JTextField, putting it into a String, and converting it to an int and solving. The problem is however, I don't want to simply put a number into the string but an actual sum including addition, subtraction etc. Currently it will accept just doing something like, 1 which will go from string and convert to an int, but when I do '1+1' or even just '1+' it throws exceptions everywhere