Current location: Hot Scripts Forums » Programming Languages » Everything Java » What is SuppressWarnings annotation in Java?


What is SuppressWarnings annotation in Java?

Reply
  #1 (permalink)  
Old 09-02-10, 12:19 AM
Learnbyexamples Learnbyexamples is offline
Disabled
 
Join Date: Jun 2010
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
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?
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Platform and Technologies Take Center Stage at India’s No.1 Software Developer Conference wonkim785 JavaScript 0 04-17-10 01:39 AM
php & java is it right choice?? mif PHP 7 02-26-08 11:11 AM
JAVA & JSP Module Dilemma!! benq Everything Java 1 10-18-06 05:20 PM


All times are GMT -5. The time now is 05:50 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.