This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
They only need to implement serializable if they are going to be serialized. It's a good idea to do so if these beans are going to be stored in session. Your sessions can't be saved across server restarts or shared in a cluster otherwise.
You should also have a zero argument constructor. (I think, technically, this is not part of the bean spec but a lot of applications require it.)
Java beans are also Java classes, but they can be considered as reusable component, which by itself is not a complete program but are used in programs. Ideally, 1. they should have no-args constructor (so that they can be instantiated at runtime by say, Class.forName(..) ) 2. They should have getter and setter methods to access their attributes 3. They support introspection if required. They can use the classes provided in java.beans package for that. 4. They can support bound and constraint properties. 5. They should support serialization if the state of the java bean needs to be persistance An Ideal GUI Java Bean can be loaded in any IDE like JBuilder,Eclipse and used just like any Swing component. Infact java swing components are Java Beans. [ February 15, 2005: Message edited by: Tanveer Rameez ]
Author of JPhotoBrush Pro (www.jphotobrushpro.com)