| Author |
Java Queries..Please help me...
|
Deepak Lal
Ranch Hand
Joined: Jul 01, 2008
Posts: 507
|
|
Hi Ranchers, I have few java queries. 1> How to write a customized(user defined) Annotation.? Can you please give me an example for user defined Annotation class for the same ? 2> What is the difference between Static import and Enum constants in java wrt java 1.5 version.? :roll: :roll: :roll: :roll: Help provided will be highly appreciated. -- Deepak Lal
|
When The Going Gets Tougher,The Tougher gets Going
|
 |
Jesper de Jong
Java Cowboy
Bartender
Joined: Aug 16, 2005
Posts: 12929
|
|
About annotations: See Annotations in Sun's Java Tutorials. Static import is not really meant for the same purpose as enums. Statically importing constants does not provide type safety like enums do. See Static import and Enums.
|
Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
|
 |
Deepak Lal
Ranch Hand
Joined: Jul 01, 2008
Posts: 507
|
|
Thanks for your valuable input, Well,I went through the above website/links and i could not find an example for the USER DEFINED ANNOTATION. Could you help me out with this.?? Please provide me with an example for User Defined Annotation ?? It will be highly appreciated if you could provide me with an example.?? Could you explain which is Type safe ?? Static Import or Enum type constants ?? what do you mean by Type-Safety ?? Help provided will be highly appreciated. -- Deepak Lal
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32712
|
|
There is a nice chapter about annotations in Bruce Eckel's Thinking in Java 4th edition, not the edition which is available free of charge. I am finding your question a bit difficult to understand; enums and static import have nothing to do with each other. There is something about the type-safe enumeration pattern in Joshua Bloch's Effective Java. You can find more about both books in our Bunkhouse. We have probably gone beyond the beginner's level now: moving thread.
|
 |
 |
|
|
subject: Java Queries..Please help me...
|
|
|