it allows access to its properties through the standard getters and setters.

Bean

A bean is a JavaBeans component, which is a reusable software component for Java. While I’m not 100% sure, it seems that “JavaBean” and “bean” are interchangeable.

POJO

POJO stands for Plain Old Java Object. Essentially, it’s the one of the simplest types of objects possible. There are no annotations, it extends no other classes, and implements no interfaces except perhaps a marker interface, such as java.io.Serializable. Finally, just like a JavaBean, it has a no-argument constructor, and allows access to its properties through the standard getters and setters.

Comparison

Some people say a POJOs can’t implement java.io.Serializable, which would mean a JavaBean is not a POJO. I would argue that a POJO can implement java.io.Serializable, since implementing marker interfaces do not corrupt the “plainness” of a POJO.

Oh, and why is it called a bean? I have no source for this, but I believe it’s because beans are used to make coffee, and java is a type of coffee, so…

1 comment for The Difference Between a JavaBean and a POJO

Good article! simply explained the difference between JavaBean and a POJO for which i have been looking for, POJOs, however, are everywhere and the a backlash against the reasons for EJBs has led to extensive use of ‘lightweight’ Java growth.Thanks for sharing!

I am Joe. I'm one of many Joes, but I am uniquely me. I'm the messiest organized guy you'll ever meet. My glasses are always bent and my hair always a mess. I've never had a role model and as such am my own person. Scientist, programmer, Christian, libertarian, and life long learner.