• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Null Pointer Exception

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm having trouble getting some code to work, it gives me a run-time error. Any help is appreciated.
 
author
Posts: 799
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You never initialize tileList. That's one potential problem, although there may be others.
It would help next time if you (a) provided code that compiled and (b) provided the stack trace.
Also, as a matter of style, put your instance variables at the top of the class, prior to any methods or constructors.
-Jeff-
[ April 01, 2004: Message edited by: Jeff Langr ]
 
Josh Ziegler
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the help. This code was being edited constantly before I posted it here so who knows what happened to the initialization of tileList. Hopefully thats it and not something more complex. Also this is a stupid question but how do you print a stack trace? Thanks again.
 
Jeff Langr
author
Posts: 799
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If your program crashes, you should see the stack trace in the console; my intent was for you to copy and paste it into your posting.
If you trap an expected exception, you can print a stack trace using the printStackTrace method defined on Throwable.
-j-
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic