+ 2
Nullpointer Exception Error Java Help me solve this
public void tableDetails() { DefaultTableModel dtm=(DefaultTableModel) jTable1.getModel(); dtm.setRowCount(0); try{ Connection con=ConnectionProvider.getcon(); Statement st=con.createStatement(); ResultSet st=rs.executeQuery("select from room"); while(rs.next()) { dtm.addRow(new Object[](rs.getString(1),rs.getString(2),rs.getString(3)}); } } catch(Exception e) { JOptionPane.showMessageDialog(null,e) } }
5 odpowiedzi
+ 1
Brother do you any whatsapp or telegram I will send the project over there so that u can look the matter
+ 1
It doesn't shows the line and also it doesn't shows any errors but when I try to run the program it shows the error
+ 1
Hmm, maybe checking the following functions can help.
"getModel" and "createStatement"
Because if you're getting a null pointer exception, that means you're using an object reference that doesn't actually refer to an object, but to a null pointer reference. In the snippet you provided, only these functions are returning an object so maybe one of them returned a null pointer reference. Try this and tell if it worked
0
Save your complete code in code playground and share it's link here so that it's easy to reproduce your error and help you =)
0
Dipankar Borah no I don't have =(
Can you say exactly in which line the exception is being shown?