jQuery in Action, 3rd edition
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
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: 4215

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

It is sorta covered in the JavaRanch Style Guide.
subject: Null dates
It's not a secret anymore!