I'm migrating from Java 1.1. to Java 5.
I notice that some methods have been deprecated e.g. java.util.Date has a getYear() method which is deprecated.
My question is if the getYear() method is left as it is in 1.1 will it still function in Java 5
Yes, it will just work as it was. It's only eligible for removal in future Java SE versions. The deprecation is purely documental and just gives you room to update the code in the meanwhile.
Currently, you're supposed to use either the methods of java.util.Calendar
or the much more improved JodaTime API. The replacement for date/time API's in standard Java SE will be similar to JodaTime and is still due to come (JSR-310). It was planned for JDK7, but unfortunately it doesn't seem to be in time.
It will still function, even though it is deprecated. They replaced it by a 'better one' (Calendar.get(Calendar.MONTH).), but the original is left there for the purpose of backwards compatibility. So it's no problem to use it in your case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With