Skip to content

Instantly share code, notes, and snippets.

@luisenriquecorona
Last active April 14, 2019 22:59
Show Gist options
  • Save luisenriquecorona/6aa030cac28273d77837238df4e0edf9 to your computer and use it in GitHub Desktop.
Save luisenriquecorona/6aa030cac28273d77837238df4e0edf9 to your computer and use it in GitHub Desktop.
Java.util.date
import java.util.Date;
/** Demonstrate deprecation warning */
public class Deprec {
public static void main(String[] av) {
// Create a Date object for May 5, 1986
// EXPECT DEPRECATION WARNING
Date d = new Date(86, 04, 05); // May 5, 1986
System.out.println("Date is " + d);
}
}
@luisenriquecorona
Copy link
Author

So, we follow orders. Recompile with -deprecation (if using Ant, use <javac
deprecation= 'true '...>) for details:
C:\javasrc>javac -deprecation Deprec.java
Deprec.java:10: warning: constructor Date(int,int,int) in class java.util.Date has
been deprecated
Date d = new Date(86, 04, 05); // May 5, 1986
^
1 warning
C:\javasrc>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment