Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Java Basics
|
Java Basics General beginning Java language questions that don't fit in one of the more specific forums. Please specify what version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 2nd, 2010, 01:20 AM
EliteHussar
Guest
 
Posts: n/a
Default What is SuppressWarnings annotation in Java?

Programming Tutorial
The @SuppressWarnings annotation tells the compiler to suppress the warning messages it normally show during compilation time. It has some level of suppression to be added to the code, these level including: all, deprecation, fallthrough, finally, path, serial and unchecked.
Code:
package org.kodejava.example.annotation;  
  
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);  
    }  
}
In the example above if we don’t use @SuppressWarnings annotation the compiler will report that the constructor of the Date class called above has been deprecated.
What is SuppressWarnings annotation in Java?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Root Cause:java.lang.NoSuchMethodError: java.util. anees81 JSP Basics 3 March 1st, 2011 08:55 AM
How to use Override annotation? EliteHussar Java Basics 0 August 27th, 2010 12:32 AM
java.lang.OutOfMemoryError: Java heap space meetkotresh J2EE 1 February 2nd, 2008 01:52 AM
Java Media Framework(I am new to java) amirdiwan4eva Pro Java 4 July 12th, 2006 04:50 AM
Java Code - Wrox - Beginning JAVA - Ivor Horton ponguru Java Databases 3 May 18th, 2006 12:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.