CodesJava

Easy learning with example program codes

SuppressWarnings java annotation

@SuppressWarningsjava annotation:

The @SuppressWarnings java annotation is used to instruct the compiler to ignore or suppress warnings.

package com.codesjava;
 
class DerecatedTestClass{  
	void display(){
		System.out.println("Display Method.");
	}  
 
	/* 
	 * @deprecated replaced by display()
     */
	@Deprecated  
	void show(){
		System.out.println("Show Method is deprecated.");
	}  
}  
 
public class SuppressWarningTest {
	@SuppressWarnings("deprecation")
	public static void main(String args[]){
		DerecatedTestClass obj = new DerecatedTestClass();
		obj.show();
		obj.display();
	}
}

Output:

Show Method is deprecated.
Display Method.

Download this example.

Please follow and like us:
error








Copyright © 2019 CodesJava DMCA.com Protection Status