• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Null Pointer Exception

 
Krishna Kodali
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This program compiled but i am getting runtime null pointer exception.

Please let me know if i am doing any thing wrong.


Output:
Exception in thread "main" java.lang.NullPointerException
at JDBCExample.main(JDBCExample.java:30)
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65124
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm, I'm trying to look at your code, but the stubborn forum software has made it look all wonky. If you use CODE tags when posting code to the forums (see the FAQ at ⇒ UseCodeTags ⇐) they tell it "Hey! Keep your hands off my formatting!" and your code will look just like when you cut and pasted it into the reply. Cool, no?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error message tells you that the NullPointerException happens at line 30. Which line is this referring to ?

Also, although you check if "conn" is not null, you don't do anything in case "conn" is null.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic