This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes What are Annotations ? Why do wee need them ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "What are Annotations ? Why do wee need them ?" Watch "What are Annotations ? Why do wee need them ?" New topic
Author

What are Annotations ? Why do wee need them ?

shukla raghav
Ranch Hand

Joined: Aug 03, 2008
Posts: 200
i stumbled upon annotations while trying to integrate GWT with Struts 2. i was looking for a GWT/Struts 2 plugin. with a great difficulty finally i found the plugin at the following URL

URL :

If you look at the webpage, the author of the plugin says

This plugin allow you to write Ext.Direct Action using annotation:
@ExtDirectAction
@ExtDirectMethod


i have never used annotation so i dont know what are they for and what it means here to use the above mentioned annotations. Please tell me in detail.

thanks in advance

Manish Singh
Ranch Hand

Joined: Jan 26, 2007
Posts: 160
annotations are like metadata for the functions and variables.
I will suggest you to read some small book or documentation about it
Ravi Choudhary
Greenhorn

Joined: Sep 03, 2009
Posts: 16
To Know more about the annotations check out this link:webpage

RaviKumar
SCJP 5.0, Preparing for Next
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38040
    
  22
Ravikumar Choudhary wrote:To Know more about the annotations check out this link:webpage
Also find the most recent edition of Thinking in Java by Bruce Eckel. Don't look in the 3rd edition or earlier.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

probably this and this link help you
Michael Angstadt
Ranch Hand

Joined: Jun 17, 2009
Posts: 273

A good example of a common annotation would be the "@Override" annotation. You can add this annotation to methods that you've overridden. The compiler will throw an error if the method actually doesn't override anything. This is great because if you accidentally misspell the name of a method you want to override, it will point it out for you.



Annotations were added in Java 1.5.


SCJP 6 || SCWCD 5
shukla raghav
Ranch Hand

Joined: Aug 03, 2008
Posts: 200
yes i have generally seen in the IDE's that attach a marked warning, the warning can be replaced by putting an annotation. I would certainly go through the linked resources provided in this section and i hope it resolves my problem.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38040
    
  22
Be careful about replacing warnings by annotations; the @SuppressWarnings annotation might allow you to bypass the type checking in generics and suffer a ClassCastException later on. Adding the @Override annotation to all overridden methods is a good idea.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What are Annotations ? Why do wee need them ?
 
Similar Threads
Using Struts2 + GWT
Struts2 in Action: Book Question
Struts GWT Plugin (File Upload Problem)
Web framework
Terrible and poor designed framework