how could I throw an exception in this case
guys, I'm reading a formula from file like: 2 + 2 - ( 3 - 1 ) * 3 $, but I want to be able to throw an exception if there are two operands together like: 2 + 2 3 * 4 $ or if there are two operators together like: 2 + + 3 $.
here's what I have so far, the operator part the program detects it, but I'm having problem with two operands together. I would like to throw the exception where "Bad Formula!..." is
String next = in.next();
oprandCount = 0;
if(oprandCount == 0)
strOut += next+" ";
next = in.next();
Re: how could I throw an exception in this case
How about that?
Originally Posted by mia_tech