Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

why "deprecated"?

 
Sean Li
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use a java.util.Date object in my program like this:
java.util.Date now= new java.util.Date();
int day=now.getDay();
but the compiler said: "ApplyForm.java": Warning #: 368 : method getDay() in class java.util.Date has been deprecated at line 129, column 11
and: Warning #: 369 : There have been deprecation warnings. Please consult the documentation for a better alternative
so, what's the better alternative?
 
Jeff Smith
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you get a deprecation warning you should check out the API for that class, it usually provides an explanation. Here's what Date's API says about getDay():
"Deprecated. As of JDK version 1.1, replaced by Calendar.get(Calendar.DAY_OF_WEEK)."
Jeff
 
Sean Li
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank u very much!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!