Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can someone look at program

 
manishjain Jain
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I just made the new program which actully compiles with no error but if run this program it give me the error of :Exception in thread "main " java.lang,NullPointerException

My program is as below:


Can someone plz look at it ....I will really appreciate if some one will help me.

Thanks
Manish Jain
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post the full stack trace and people will help.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We prefer a linenumber, and a mark, where this line is in the source-code, because we don't like counting to 297, and small differences in the layout may confuse our counting.



... but I found it without that.

You declare 'Statement statement' and 'Connection connection' in your class.
While initialising, you declare a new 'Statement statement' and 'Connection connection' in main, only locally visible, and hiding the class-attribut.
Later the local variable is out of scope - invalid, invisible, - and the class-member is used.
Which is null - has never been initialised.
[ July 28, 2004: Message edited by: Stefan Wagner ]
 
manishjain Jain
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Stefan,

Thankyou very much. It solved my problem. I must say you are very knowledgeble and very nice. Thanks for a such a great help from you.

Thanks
Manish
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic