Annotations specific to packages are added in package-info.java as in the following screenshot. Here, the modern.challenge package was annotated with the @Packt annotation:
A convenient solution to inspect the annotations of a package starts from one of its classes. For example, if, in this package (modern.challenge), we have the Melon class, then we can obtain all annotations of this package as follows:
Class<Melon> clazz = Melon.class;
Annotation[] pckgAnnotations = clazz.getPackage().getAnnotations();
Annotation[] printed via Arrays.toString() reveals a single result:
[@modern.challenge.Packt()]