Collected Java Practices
javapractices.com offers concise presentations of Java practices, tasks, and designs,
illustrated with syntax-highlighted code examples.
The code examples are available for download.
See below for user comments on the site.
Science is the organized scepticism in the reliability of expert opinion. |
- The Physics Teacher (Sep 1969), Richard Feynman |
Servlets and JSPs
Swing
Exceptions
Input-Output
Always close streams | Buffering usually appropriate |
Console input | Copy a file |
Reading and writing binary files | Reading and writing Serializable objects |
Reading and writing text files |
Databases
Collections
Overriding Object Methods
Avoid clone | Implementing compareTo |
Implementing equals | Implementing hashCode |
Implementing toString | Never rely on finalize |
Common Tasks
Common Design Patterns
Common Practices
Inheritance
Consider composition instead of subclassing | Designing for subclassing |
Overridable methods need special care | Remember styles of inheritance |
More Common Practices
Assertions
Assert is for private arguments only | Assert use cases |
Assertions in general | Force enabling of assertions |
Constructors
Serialization
Implementing Serializable | Serialization and subclassing |
Some classes need readResolve |
Threads
User Comments | |
"I just wanted to take a second to say that this site is really useful. It's not all that often that I come across a site that has some good design information without a bunch of boring fluff. It reminds me of reading Effective Java, which I would consider to be one of the best books I've ever picked up." | |
"I love this site. It's one of the best laid out and most useful sites that I've ever used. Thank you very much." | |
"First I have to say, what a great site. We were thinking about starting something similar inside the company, but what better news than to hear that someone has done it for us. Keep up the great work." | |
"I do think this site is excellent. Keep it up." | |
"Awesome for a beginner like me!" | |
"A Great Site!!! I refer to it often. I really enjoy your common sense and straight forward, flexible approach to these issues. Thanks!" | |
"Thanks for a great site, it really stands out from the crowd. Keep up the good work!" |