Thread: Custom Annotation

Forum : New To Java   09-3-2018 02:56:47 PM
User Image
Amit1992

Newbie

Joined: Jun 25, 2017

Points: 100

Threads: 4

Posts: 6

Custom Annotation

| Quote Date : Mar 9, 2018    Views:406    

How to create custom annotation?

tags: java

Comments

User Image
Amit1992

Newbie

Joined : Jun 25, 2017

Points : 100

Threads: 4

Posts: 6

Re: Custom Annotation

Reply Date : Mar 13, 2018

Can you elaborate this code? 

public @interface MySampleAnn {
 
    String name();
    String desc();
}
 
class MyAnnTest{
     
    @MySampleAnn(name = "test1", desc = "testing annotations")
    public void myTestMethod(){
        //method implementation
    }
}?

Replied by Akshay4342
User Image
Akshay4342

Newbie

Joined : Apr 20, 2017

Points : 100

Threads: 0

Posts: 2

Re: Custom Annotation

Reply Date : Mar 10, 2018

public @interface MySampleAnn {
 
    String name();
    String desc();
}
 
class MyAnnTest{
     
    @MySampleAnn(name = "test1", desc = "testing annotations")
    public void myTestMethod(){
        //method implementation
    }
}?

Load More

No More Comments