This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
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 Elasticsearch in Action this week in the Big Data 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: 3658

Sounds like a recipe for disaster. Why are you setting the date if you have no date to set?
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