It is worth noting what happens if we feed in different kinds of erroneous input to our program. For example, try:
echo 2-2 | java ArithmeticTest
and then:
echo 2 + +2 | java ArithmeticTest
In the first case, the expression 2-2, the parser throws a LexicalException, indicating that there is a lexical probem in the input. However, on the second input, 2 + +2, a different exception class is thrown, namely ParseException, and the error message is quite different. It is complaining about the second + character, saying that it is expecting a number here.
It is worth understanding why these are two completely different kinds of error. You see, your parser machinery actually contains two distinct "machines". The first is a Lexer, which breaks the input down into tokens. In our specific case, that means that it reads the input and converts it into a stream of numbers and plus signs. That stream of tokens is what is fed into another machine (the parser proper, one could say) that groups these tokens into the various syntactical productions that make up the grammar. So, you see, for the first input, it is actually the Lexer that is failing to break up the input into tokens; it is completely bewildered (pardon the anthropomorhism) once it hits the minus sign, for the simple reason that there is no token in the grammar that contains that character.
On the other hand, in the second case, the Lexer machinery has no problem doing its job of breaking the input into tokens. The Lexer is completely happy (again, pardon the anthropomorphism) as it sees a number followed by a plus sign, followed by another plus sign, followed by a number. Put another way, there is no lexical problem here. Of course, there is a problem, but it is at a higher (syntactical) level, and thus, is caught at that level.