Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Annotations Writing Your Own Annotation Declaring an Annotation

M. Brown
M. Brown
29,923 Points

I'm posting another topic of this because I still don't have an answer.

And a week later no one has answered it and I'm not able to bump it up either...

LiveTweet.java
@Retention(LiveTweet = RetentionPolicy.RUNTIME)

2 Answers

Alexander Nikiforov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 Points

Have you watched a previous video

https://teamtreehouse.com/library/java-annotations/writing-your-own-annotation/starting-the-annotation-declaration-and-retention

As you at second 00:10 he is writing Doc annotation.

You declare it as a class but with @interface keyword instead of class, does it make sense ?

What you are writing is not a declaration of annotation LiveTweet, but you write annotation to annotation that we can apply to other annotation...

Does that sound helpful ?

M. Brown
M. Brown
29,923 Points

This is what I have now:

import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy;

@Retention(LiveTweet = RetentionPolicy.RUNTIME) public @interface doc {

}

Still don't have it....

M. Brown
M. Brown
29,923 Points

I read the other topic and they were saying to start around 0:50. This is as much as I got from it. I will attempt again.

Alexander Nikiforov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 Points

Ok. It seems that you have enough of this. The answer to the first challenge is

public @interface LiveTweet {

}

As you see we declare an annotation called LiveTweet in file called LiveTweet.java using @interface and name of the annotation after all.

Now try the second challenge