Question: Similar to [this question](https://stackoverflow.com/questions/233030/worst-php-practice-found-in-your-experience)...

What are the worst practices you actually found in Java code?

Mine are:

* using instance variables in servlets (it's not just bad practice but bug, actually)
* using Collection implementations like HashMap, and not using the appropriate interfaces
* using seemingly cryptic class names like SmsMaker (SmsFactory) or CommEnvironment (CommunicationContext)

Answer: 
Six really bad examples;

* Instead of error reporting, just
`System.exit` without warning. e.g.  

`if(properties.size()>10000) System.exit(0);` buried deep in a
library.
* Using string constants as
locks. e.g. `synchronized("one") { }`.
* Locking on a mutable field. e.g. `synchronized(object) { object = ...; }`.
* Initializing static fields in the constructor.
* Triggering an exception just to get a stack trace. e.g. `try { Integer i = null; i.intValue(); } catch(NullPointerException e) { e.printStackTrace(); }`.
* Pointless object creation e.g. `new Integer(text).intValue() or worse new Integer(0).getClass()`
Not closing database connections, file handles etc in a finally{}