Some mistakes I have seen people make who are experienced at programming but not at Java:
- Classes implicitly extend
Object
- Classes implicitly import
java.lang.*
- instanceof doesn't require a not null check
- Upcasting, e.g.
((Object)new Integer(1)).toString(), is almost never useful as it doesn't affect dynamic method selection
- Strings are immutable. There is no need to copy or clone them.
- Don't rely on the garbage collector or
finalize() to perform resource (rather than memory) management. Resources, e.g. files, should be closed explicitly.
- Swing components, once displayed, should only be accessed from the AWT event thread (typically using
SwingUtilities.invokeLater()).
- In general, be very, very careful when multiple threads share the same mutable/stateful objects. Either copy your objects first, or be prepared to use a while lot of
synchronized blocks, wait() and notify().