Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Can someone look at program

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Post the full stack trace and people will help.
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Hot dog! An advertiser loves us THIS much:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic