| Author |
can timestamp be given null values
|
neha priya
Ranch Hand
Joined: Jul 03, 2010
Posts: 62
|
|
hello everyone,
my query is that can timestamp take null value??
suppose i have a date combobox that is initially set to null value.
if someone doesn't provide any value in the datecombobox and leaves it null then will this statement run?[size=12]
please suggest me some method how can i provide null value or empty value to datecombobox and be able to compile it successfully.
thanks.
[/size]
|
 |
Martin Vanyavchich
Ranch Hand
Joined: Sep 16, 2008
Posts: 241
|
|
Hi,
I'm not sure if I understand all the implications but I think this should work.
For code readibility you could expand that in a full if statement
|
SCJP 6, OCMJD 6, OCPJWSD 6
I no good English.
|
 |
neha priya
Ranch Hand
Joined: Jul 03, 2010
Posts: 62
|
|
thanks for replying....i tried what you suggested i.e.
but during runtime am getting:java.lang.NullPointerException
please suggest how do i resolve this..
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19230
|
|
I don't think it's startDateCombo that will be null but startDateCombo.getDate. So:
Note that I have chosen to make the entire Timestamp null rather than give it a time of 0.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
buntha Choudhary
Ranch Hand
Joined: Jul 03, 2009
Posts: 136
|
|
|
we can provide the default value for the comboBox with current date , if in case no value is being provided.
|
 |
 |
|
|
subject: can timestamp be given null values
|
|
|