Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2008
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question error detection how to detect

    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

    thanks

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    You might want to specify what language you are using.
    OracleGuy

  • #3
    New Coder
    Join Date
    Aug 2008
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts
    java

    NetBeans 5


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •