• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java Queries..Please help me...

 
Ranch Hand
Posts: 603
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 603
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic