Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Queries..Please help me...

 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15214
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic