Intro to Java Annotations

This entry is part 9 of 13 in the series Intro to Java

Annotations allow you to attach metadata to a field, class, or method. Metadata is data that describes something else. For example, metadata about a song in mp3 format could be the artists name or the bit rate it was encoded at. A jpeg image could have metadata that described the image height or the number of colors in the image.

What do they look like?

@Override
public String getName() {
	return "no name";
}

The word after the ‘@’ is the Annotation. It precedes a method or class name. The Override annotation is built into Java. It is used to indicate that a method overrides a parents method. These are used for compiler hinds, for documentation, and to apply meta data.
Continue reading