• Post Reply Bookmark Topic Watch Topic
  • New Topic

Annotions  RSS feed

 
Alexandre Mendes
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm create um Annotations, but, I want create only name within the parameter. does not compile.

public @interface Author{

Here. Can I user
String Name;

}

@Author("Name");

public class MyClass{
....
}
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're using the wrong syntax. It should be something like this:

For a tutorial, see: Annotations
 
Alexandre Mendes
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper de Jong wrote:You're using the wrong syntax. It should be something like this:

For a tutorial, see: Annotations


Thanks. Your syntax It's correct. I was looking the Tutorial, but, there have much information, I liked. I can user this syntax:

public @interface Author{
String value();
}

@Author("Alexander")
public class Example{
//...
}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!