PDA

Click to See Complete Forum and Search --> : warning


quipy
Apr 30th, 2003, 06:16 AM
Note: C:\...Driver2.java uses or overrides a deprecated API. Recompile with "-deprecation" for details.

how significant is this warning message? should i be worried about getting it fixed?

CreoN
Apr 30th, 2003, 07:18 AM
Yes :)
As it sais, recompile with -deprectation to see which method you uses that are deprecated, and look in the API if there are some replacement for that method. There usually are.

quipy
Apr 30th, 2003, 07:47 AM
this is what i'm using:

Date x;

x = new Date(year, month, date);

apparently i need to use the Calendar.set(year,month,date) method... but how do i use it exactly? would "x" be still defined as type Date?

CreoN
Apr 30th, 2003, 08:04 AM
Take a look at GregorianCalendar. It might be a better solution. You can use the constructor just as you use the constructor in the Date class.
GregorianCalendar(int year, int month, int date)
And since it extends Calendar I think you've got what you need :)

quipy
Apr 30th, 2003, 08:12 AM
but i need the date to be of type DATE... can i use the methods in GregorianCalendar but still maintain DATE?

CreoN
Apr 30th, 2003, 08:17 AM
You've got one method that might work (haven't tried it)
From the API

public final Date getTime()

Gets this Calendar's current time.


So create new instance of GregorianCalendar, with all the values, and then use getTime() on the instance and there's your Date object :)

quipy
Apr 30th, 2003, 08:55 PM
it might be deprecated, but i'm bound to use the date type. but using:


int year, month, day;
Date something = new Date(year, month, day);


displaying the date again shows an entirely different date than what was inputted. huh?