Deprec.java

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); } }
Java.util.date

1 Response

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>

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.