Java Retention Policy, SOURCE,CLASS,RUNTIME

Categories: Java 9 Java 8(JDK1.8)


Retention Policy: A retention policy determines at what point an annotation is discarded. 

It is s specified using Java's built-in annotations: @Retention


1.SOURCE: annotation retained only in the source file and is discarded

          during compilation.Example: @Override, @SuppressWarnings

2.CLASS: annotation stored in the .class file during compilation,

         not available in the run time.

3.RUNTIME: annotation stored in the .class file and available in the run time.Example: @Deprecated

Top Blogs
Java Retention Policy, SOURCE,CLASS,RUNTIME Published at:- Do you know the top new features of Java 9 Published at:- Why to Learn java Programming? Published at:- How to Optimize Java Apps on Kubernetes Published at:- When and Why Java is utilized for Application Improvement Published at:- Tips and Tricks to Win with Slot Machines 2024 Published at:- Interface and Usability of 1win: User Experience Published at:-
R4R.co.in Team
The content on R4R is created by expert teams.