Easy learning with example program codes

Deprecated Java Annotations

Dictionary meaning of Annotation

Annotation refers to a note by way of explanation or comment added to a text or diagram.

Java Annotations:

Java annotations are used to provide the meta data to our Java code. Meta data is the additional information which can be used for any class, interface, method or field. Java annotations can be used as an alternative option for XML and java marker interfaces. Java annotations were added to Java from Java 5.

@Deprecated java annotation:

The deprecated terms in software development is refers to classes, interfaces, functions or elements that are in the process of being replaced by newer ones. The @Deprecated java annotation signals that the marked element is deprecated and should no longer be used. It is better not to use deprecated methods because these methods can be removed from future versions.

Note: We can use @deprecated Javadoc tag in the comment section to inform the developers about the reason of deprecation and what can be used in place of this deprecated method, class or field.

package com.tutorialspointexamples;
class DerecatedTestClass{  
	void display(){
		System.out.println("Display Method.");
	 * @deprecated replaced by display()
	void show(){
		System.out.println("Show Method is deprecated.");
public class DeprecatedTest {
	public static void main(String args[]){
		DerecatedTestClass obj = new DerecatedTestClass();;


Show Method is deprecated.
Display Method.

Download this example.

Sign Up/ Sign In
Ask a Question

Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at


We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on

Copyright © 2018 CodesJava Protection Status SiteMap Reference: Java Wiki