Can't find ho to resolve this EXCEPTION.

I have some code that uses the     JOptionPane.showInputDialog  to
accept some data
When the CANCEL option is used -- and I expected to habe a null in the
receiving string (inputName as seen in next snippet of code )

  Flow of program never gets to the IF statement when CANCEL option is
used


  while ((nameCount < names.length) && (endLoop != true)) {
         inputName = JOptionPane.showInputDialog("Enter First & Last
name (up to three)");
           if (inputName.isEmpty( )) {
            endLoop = true;
          } else {

this exception is generated,

Exception in thread "main" java.lang.NullPointerException
        at TwoDimArrayOfNames.main(TwoDimArrayOfNames.java:31)
Java Result: 1
BUILD SUCCESSFUL (total time: 6 seconds)


when data is entered properly and the OK option used -- all's well

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to