• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Problems with scope and class  RSS feed

 
Ranch Hand
Posts: 70
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am still having a hard time understanding scope and classes.

Here is a program I am working on and have a problem with on line 91.  Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
at citationformatter.CitationFormatter.formatcitation(CitationFormatter.java:91)

I am trying to add content to the text area so that it can be formatted. I am sure it is some type of scope. I keep thinking that anything created Public should be available anywhere in the project but maybe not.

I have read and re-read the tutorials on classes but cannot get the hang of it. Maybe if I could just see and outline of the class I should be using.

I appreciate the patience and help
Thanks
Roger

 
Rancher
Posts: 3341
33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

have a problem with on line 91.  
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
at citationformatter.CitationFormatter.formatcitation(CitationFormatter.java:91)

The first thing you need to do is find the variable with the null value.  If you can't tell what variable is null, add a print statement just before the line where the exception happens that prints out the contents of the variables on the line where the exception happens.
When you find the variable that is null, backtrack in the code to see why it does not have a valid value.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!