PDA

View Full Version : error detection how to detect


Inquisit
09-01-2008, 09:59 PM
Question

ive encountered a little challenge

ive tried to make my program detect an error

i.e such as NaN and then it displays a message dialog saying Syntax error

the problem is this works but the dialog keeps poping up when simple arithmetics are performed with proper answers NaN and Infinity
what i would like to achieve is just NaN or Infinity etc detected not everything

i.e
txtNumber1 ......N1
txtNumber2

sum=N1+N2

Answer=value of (sum);

i want the dialog to appear when Nan or Infinit appears in the Answer text
ive tried if but fails to detect it

i.e

if (sum).equals("NaN");
Messadialog appears saying syntax, math etc errors

||

if (sum).equals("Infinity");

Messadialog appears saying syntax, math etc errors user presses OK then refreshes the panel


this is where your expertise fits in :confused:

thanks

oracleguy
09-02-2008, 02:31 AM
You might want to specify what language you are using.

Inquisit
09-02-2008, 10:28 AM
java

NetBeans 5