O'Reilly logo

Beginning Java 8 Language Features: Lambda Expressions, Inner Classes, Th reads, I/O, Collections,and Streams by Kishori Sharan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 1

image

Annotations

In this chapter, you will learn

  • What annotations are
  • How to declare annotations
  • How to use annotations
  • What meta-annotations are and how to use them
  • Commonly used annotations
  • How to access annotations at runtime
  • How to process annotations in source code

What Are Annotations?

Annotations were introduced in Java 5. Before I define annotations and discuss their importance in programming, let’s discuss a simple example. Suppose you have an Employee class, which has a method called setSalary() that sets the salary of an employee. The method accepts a parameter of the type double. The following snippet of code shows a trivial ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required