What are the roles and reasons for using Annotation in Java? Give real time demonstration example

Questions by Dương Văn Định

Showing Answers 1 - 6 of 6 Answers

  • Oct 28th, 2011
 

The usefulness of annotation can be found in J2ee,where we deal with xml files.

To get the value from xml files,j2ee technology uses parsers like xerces,jdom,sax etc.Working with parser is always a heavy weight task,and it kills your performance.

So annotation can be used instead of xmls.Annotation are the java statement which can be used instead of xmls

But if you use annotation,you will lose the flexibility to modify,The java classes need to be modified and recompiled.

Conclusion:- go for xml when u need flexibility,
go for annotation when u need performance

  Was this answer useful?  Yes

sampra

  • Mar 13th, 2012
 

in the annotaion we are providing the meta data. this job previously done in xml file which causes lot of mentenece.so benifit of annotaion is to mainly provide the meta data information in java file and reduce the mantinence

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions