June 2018
Beginner
722 pages
18h 47m
English
The separator @ (at sign) is used to denote an annotation:
@Overrideint someMethod(String s){ //...}
You have seen several examples of an annotation when we created a unit test in Chapter 4, Your First Java Project. There are several predefined annotations in the Java standard libraries (@Deprecated, @Override, and @FunctionalInterface, to name a few). We are going to use one of them (@FunctionalInterface) in Chapter 17, Lambda Expressions and Functional Programming.
The annotations are metadata. They describe classes, fields, and methods, but they themselves are not executed. The Java compiler and JVM read them and treat the described class, field, or method in a certain way depending on the annotation. For example, in Chapter ...
Read now
Unlock full access