Solved

What is deprection in java ?

Posted on 2003-11-07
5
210 Views
Last Modified: 2008-03-03

I have this error.

The method getYear invoked for type java.util.Date with arguments ()
is deprecated.

What exactly does this mean ??


How would I resolve this ?

0
Comment
Question by:pheats
  • 3
5 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 9700188
It means that thse methods are on the way out and Sun wants to tell you so. You should use a Calendar to do this.
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 30 total points
ID: 9700197
Calendar cal = Calendar.getInstance();
cal.setTime(yourDate);
int year = cal.get(Calendar.YEAR);
0
 
LVL 5

Expert Comment

by:arjanh
ID: 9700209
Deprecated means that you preferably shouldn't use it in new programs. It is not really an error, just a warning.
Calendar.get(Calendar.YEAR) - 1900
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9700250
>>  It means that thse methods are on the way out

CEHJ is right.  However, I don't know of any deprecated items that have actually been removed yet?

Does anybody know of any?

(Just for interest ;-))
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 9700530
I don't know of any personally ;-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
The viewer will learn how to implement Singleton Design Pattern in Java.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now