Click here to watch in Youtube :
https://www.youtube.com/watch?v=dScdAalKi5U&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
![]() |
Java Tutorial: Annotations in java | Java annotations [How to declare an annotation type] |
![]() |
Java Tutorial: Annotations in java | Java annotations [How to declare an annotation type] |
![]() |
Java Tutorial: Annotations in java | Java annotations [How to declare an annotation type] |
import java.lang.annotation.Documented;
@Documented
@interface ClassPreamble
{
String author();
String date();
int currentRevision() default 1;
String lastModified() default "N/A";
String lastModifiedBy() default "N/A";
// Note use of array
String[] reviewers();
}
MyClass.java@ClassPreamble
(
author = "Ram",
date = "3/17/2017",
currentRevision = 2,
lastModified = "4/12/2017",
lastModifiedBy = "Peter",
// Note array notation
reviewers = {"Alice", "Bob", "Cindy"}
)
public class MyClass
{
// class code goes here
}
Click the below link to download the code:
No comments:
Post a Comment