AIzaSyCSBAtE3BpAxQTGlq481leTTYyd4sj4Om0 Java Programming/Annotations/Compiler and Annotations Resource Page | Learn About, Share and Discuss Java Programming/Annotations/Compiler and Annotations At Defaultlogic.com




Java Programming/Annotations/Compiler and Annotations


Annotations can be used by the compiler to carry out certain directives. Much that you'd love programming in Java, you probably would have been fussed about compiler warnings. Compiler warnings are not necessarily errors but are warnings that tell you the code might malfunction because of some reason.

Taming the compiler

You can issue directive to the compiler in the shape of three pre-defined annotation to tell it what sort of pre-processing a certain bit of code requires. The three annotations are:

  • @Deprecated
  • @Override
  • @SuppressWarnings(..)

@Deprecated is used to flag that a method or class should no longer be used, normally because a better alternative exists. Compilers and IDEs typically raise a warning if deprecated code is invoked from non deprecated code. [1]

@Override flags that a method overrides a method in a superclass. If there is no overridden method, a compile error should occur. [2]

@SuppressWarnings(..) SuppressWarnings tells the compiler not to report on some, or all, types of warnings. It can be applied to a type, a method or a variable. [3]

External links

  • [4] Advanced usage of the @SuppressWarnings(..) annotation


Clipboard

To do:
Add some exercises like the ones in Variables


  This article uses material from the Wikipedia page available here. It is released under the Creative Commons Attribution-Share-Alike License 3.0.

Java_Programming/Annotations/Compiler_and_Annotations
 



 

Connect with defaultLogic
What We've Done
Led Digital Marketing Efforts of Top 500 e-Retailers.
Worked with Top Brands at Leading Agencies.
Successfully Managed Over $50 million in Digital Ad Spend.
Developed Strategies and Processes that Enabled Brands to Grow During an Economic Downturn.
Taught Advanced Internet Marketing Strategies at the graduate level.


Manage research, learning and skills at defaultLogic. Create an account using LinkedIn or facebook to manage and organize your Digital Marketing and Technology knowledge. defaultLogic works like a shopping cart for information -- helping you to save, discuss and share.

Visit defaultLogic's partner sites below:
PopFlock.com : Music Genres | Musicians | Musical Instruments | Music Industry
NCR Works : Retail Banking | Restaurant Industry | Retail Industry | Hospitality Industry

  Contact Us