• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

why "deprecated"?

 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank u very much!
 
You can't have everything. Where would you put it?
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic