TechieDrill Your World Of Technical Tutorials

Java SuppressWarnings

11.23.2009 · Posted in Java

Java Annotation offers a feature to suppress warnings that occurs during compile time. Basically there are seven level of suppressions that can be added to the java class

They are as follows:

  • all
  • finally
  • serial
  • path
  • fallthrough
  • unchecked
  • deprecation

Find below the deprecation suppress warning example

import java.util.Date;
public class SuppressWarningsExample
{
//@SuppressWarnings(value=(”deprecation”))
public static void main(String args[])
{
Date date = new Date(2008,9,30);
System.out.println(”date = ” +date);
}
}

import java.util.Date;


public class SuppressWarningsExample

{

//@SuppressWarnings(value=(”deprecation”))

public static void main(String args[])

{

Date date = new Date(2008,9,30);


System.out.println(”date = ” +date);

}

}

Leave a Reply

You must be logged in to post a comment.