Tutorial by Examples

public class Foo { private String name; public Foo(@NonNull String name){...}; ... } Here @NonNull is annotation which is processed compile time by the android studio to warn you that the particular function needs non null parameter.
There are three types of annotations. Marker Annotation - annotation that has no method @interface CustomAnnotation {} Single-Value Annotation - annotation that has one method @interface CustomAnnotation { int value(); } Multi-Value Annotation - annotation that...
For creating custom annotations we need to decide Target - on which these annotations will work on like field level, method level, type level etc. Retention - to what level annotation will be available. For this, we have built in custom annotations. Check out these mostly used ones: @Target...

Page 1 of 1