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: 
Once I encountered 'singleton' exception:

```
class Singletons {
    public static final MyException myException = new MyException();
}

class Test {
    public void doSomething() throws MyException {
        throw Singletons.myException;
    }
}

```

**Same instance of exception** was thrown each time ... with exact same stacktrace, which had nothing to do with real code flow :-(
Not thinking like a programmer should.
======================================

**After prolonged exposure, Java does that to some people.**

Why? My opinion is that it's because there's **too much Intellisense and no sense**. It lets you do stupid things so quickly that people don't stop to think.

**Example 1:**

```
boolean negate( boolean shouldNegate, boolean value ) {
  return (shouldNegate?(!value):value;
}

```

which, of course is the same as value ^ shouldNegate, a simple XOR.

**Example 2:** (I swear I'm not making this up)

```
boolean isNotNull( Object o ) {
  return o != null;
}

```

Both with additional 4-6 lines of Javadoc, *explaining* what those methods did.

**Example 3:**

```
/**
*
*
*/

```

An empty Javadoc, to make those *annoying* Eclipse "missing Javadoc" warnings go away.

**Example 3b:**

```
/**
* A constructor. Takes no parameters and creates a new instance of MyClass.
*/
public MyClass() {
}

```