What are the best java example sites? By which I mean places that you go when you have a specific question, and you want a little java code snippet to solve it.
I like Java Almanac (now renamed www.exampledepot.com/). It has great examples and very pertinent questions, but it only goes through java 1.4, so unfortunately it's pretty out of date. It has good coverage of simple questions like "Quintessential Regular Expression Search and Replace Program" and "Reading Text from a File". Also covers some more complicated topics.
Another site I like is javapractices.com. This one answers questions at a little higher level than Java Almanac, for example "Modernize old code" or "Know the core libraries".
java2s is the best according to me. because - 1) Like mrlinx said "almost always has a sample on common stuff" 2) Stuffs are nicely organized by category, so, you can easily find out what you are looking for. 3) You can find codes for latest version of JDK
Wait a minute...
By re-reading your question... I think this site (i.e. stackoverflow) is the very best place for what you are asking for!
You can publish a problematic java snippet and receive answer.
Case in point : What is the syntax for mod in java
I have to leave you now: I need to check my profile.
I might have just received my first "brown-nose" badge ;-)
A place I get a lot of samples / answer to questions is the forums of the sun java web site itself. If the answer isn't there, usually users will point you in the right direction.
I like http://jexamples.com . This has real working code indexed from open source projects. The site also incorporates ratings so the best examples are shown.
regarding to that ropic:
for all the beginners in Hibernate ,
here you can find a nice video with step by step tutorial how to set up the environment In Hibernate