POJO stands for Plain Old Java Object. This is different from Plain Old Javascript Objects.
A Plain Old Java Object refers to the Object-oriented programming (OOP) paradigm that is used in the Java programming language.

The OOP model treats data as objects. Each object is an instance of a Class, which represents the archetype or template from which all objects inherit their properties and attributes.

POJO Required Criteria

A POJO is therefore simply a Java Object. However, it must also satisfy the following additional criteria:

It must not extend pre-specified Java Classes.

public class Foo extends javax.servlet.http.HttpServlet { ...// body ... }

It must not implement pre-specified Interfaces.

public class Bar implements javax.ejb.EntityBean { ... // body }

It must not contain pre-specified Annotations.

@javax.persistence.Entity public class Baz { ... // body ... }

For any class field which is marked as private, it must have getter and setter methods alongside it. Also, it must have an EMPTY constructor if the custom constructor declared.

public class Car { private int gear; // default constructor public Car() { } // custom constructor public Car(int car){ = car; } public int getGear() { return this.gear; } public void setGear(int gear){ this.gear = gear; } }

Therefore a Java Object qualifies as a POJO only when it is free from the above modifications. It therefore follows that a POJO is not ‘bound by any restrictions’ other those prescribed by the formal Java language specification.

POJO is usually used to describe a class that doesn’t need to be a subclass of anything, or implement specific interfaces, or follows a specific pattern. It has properties, getters, and setters for respective properties. It may also override Object.toString() and Object.equals().

More Information:

Wikipedia – POJOs

This article needs improvement. You can help improve this article. You can also write similar articles and help the community.