Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing a final static variable using Field.get(...)

 
Garann Means
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to get access to four String constants elsewhere in my API. Which four constants is determined based on the input data. My code compiles, but throws a NullPointerException. This is what it looks like:

The first try block executes nicely. I get a NullPointer in the second. I have tried sending both "null" and "new String()" as parameters to Field.get(), neither with success.
The constants I'm trying to capture look like this:

Can anyone see what I'm doing wrong?
Many thanks,
g.
[ July 03, 2002: Message edited by: Garann Rose Means ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic