my dog learned polymorphism
The moose likes Swing / AWT / SWT and the fly likes Null dates Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Null dates" Watch "Null dates" New topic

Null dates

Giuseppa Cefalu
Ranch Hand

Joined: Jul 15, 2011
Posts: 121
In the code below a date must be a date object and therefore date cannot be initiliazed to zero. I have to use a date object becuase the setValue method only takes a date. If I initialize the date to null, i get an exception in thread main null pointer exception. Is there any workaround so that one can initialize the date to 0 or null and still gat a date object that can be accepted by the setValueAt() method? Thank you

Stephan van Hulst

Joined: Sep 20, 2010
Posts: 4628

Sounds like a recipe for disaster. Why are you setting the date if you have no date to set?

The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
Giuseppa Cefalu
Ranch Hand

Joined: Jul 15, 2011
Posts: 121
Thank you very much!!! Your comment was very helpful. All I need is

I agree. Here's the link:
subject: Null dates
It's not a secret anymore!