Annotations

Annotations, which are a form of metadata, provide data about a program that is not part of the program itself. Annotations can then be used by the compiler or by your own code via reflection at runtime. Depending on the annotation value, the meaning of the program or data can change.

Annotations have a number of uses, among them:

  • Information for the compiler — Annotations can be used by the compiler to detect errors or suppress warnings.
  • Compile-time and deployment- time processing — Software tools can process annotation information to generate code, XML files, and so forth.
  • Runtime processing — Some annotations are available to be examined at runtime.

There are certain annotation are present in both Java and kotlin as part of standard libraries.For example : @SuppressWarnings, @Override

Annotations syntax contain @ sign followed by annotations name, You can apply annotation for classes, functions, properties.

Kotlin enables the user to apply the annotation for files and expression as well, this features is not present in java and some other languages.

Annotations with constructor

To annotate the primary constructor, it is mandatory to mark the constructor with constructor.


class Bucket @SomeAnnotations constructor(full:Boolean){
}	

@JvmName annotations in kotlin

aaaaaaaaaaaaa
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions

Recent Addition

new tutorial Selenium Online Training : Our next online training course for Selenium with Java starts from 17th December 2018.

You can attend first 3 classes for free, the total course fee is INR 10,000

The course time would be 8.00 PM(IST) for the first three classes

If you are interested to learn, then you can join the course by sending email to chercher.tech@gmail.com

or Register below


 
Join My Facebook Group
Join Group