What is POJO in Java?

POJO stands for “Plain Old Java Object” — it’s a pure data structure that has fields with getters and possibly setters, and may override some methods from Object (e.g. equals) or some other interface like Serializable, but does not have behavior of its own.

 

  1. Normal Class: A Java class
  2. Java Beans:
    • All properties private (use getters/setters)
    • A public no-argument constructor
    • Implements Serializable.
  3. Pojo: Plain Old Java Object is a Java object not bound by any restriction other than those forced by the Java Language Specification. I.e., a POJO should not have to
    • Extend prespecified classes
    • Implement prespecified interface
    • Contain prespecified annotations