July 09, 2008

Top Ten Errors Java Programmers Make

Hi guys.. I found this article on the internet.This article written by David Reilly. Very good article I guess.

Whether you program regularly in Java, and know it like the back of your hand, or whether you're new to the language or a casual programmer, you'll make mistakes. It's natural, it's human, and guess what? You'll more than likely make the same mistakes that others do, over and over again. Here's are top ten list of errors that we all seem to make at one time or another, how to spot them, and how to fix them.

1. Null pointers
2. Capitalization errors
3. Preventing concurrent access to shared variables by threads
4. Forgetting that Java is zero-indexed
5. Writing blank exception handlers
6. Confusion over passing by value, and passing by reference
7. Comparing two objects ( = = instead of .equals)
8. Comparison assignment ( = rather than = = )
9. Mistyping the name of a method when overriding
10. Accessing non-static member variables from static methods (such as main)

These errors represent but some of the many that we all make. Though it is impossible to completely eliminate errors from the coding process, with care and practice you can avoid repeating the same ones. Rest assured, however, that all Java programmers encounter the same sorts of problems. It's comforting to know, that while you work late into the night tracking down an error, someone, somewhere, sometime, will make the same mistake!

For details about this article, please visit http://www.javacoffeebreak.com/articles/toptenerrors.html

Selamat berprogramming ;)

1 comment:

Jumari said...

Cayalah Java Otai programmer.. :)