Re: NumberFormatException

2024-08-03 Thread Scott Palmer
Change if (str ==“”) to  if (str.isEmpty())Don’t use == to compare strings. The empty string from the text field is a different entity than the constant pool empty string. You are doing an identity comparison. ScottOn Aug 3, 2024, at 10:17 PM, Pieter van den Hombergh wrote:an empty string is neve

Re: NumberFormatException

2024-08-03 Thread Pieter van den Hombergh
an empty string is never a valid number. for a valid number you need at least one digit inside the string. met vriendelijke groet Pieter van den Hombergh Op za 3 aug 2024, 20:58 schreef Zulfi Khan : > Hi, > > I have written the following function: > > > private boolean jDelBtnActionPerformed(java

NumberFormatException

2024-08-03 Thread Zulfi Khan
Hi, I have written thefollowing function: private booleanjDelBtnActionPerformed(java.awt.event.ActionEvent evt) { // TODO addyour handling code here: JOptionPane.showMessageDialog(null, "Inside Delete Btn"); String str =""; try{ str =jTF1.getText().trim(); }catch(java.lang.NumberFo