盗用两篇文章吧,因为觉得别人总结的已经够好了
http://blog.csdn.net/evankaka/article/details/45580845
http://www.blogjava.net/Alpha/archive/2007/07/23/131912.html