What is a POJO?
POJO stands for Plain Old Java Object. It is a term used to describe a simple Java class that follows basic coding conventions and does not depend on any specific frameworks or external libraries.
In simple words, a POJO is just a normal Java object created to hold and manage data in a clean and straightforward way.
Key Features of a POJO
A typical POJO usually includes:
Private variables (fields) to store data
Public getter and setter methods to access and update those fields
Optional methods for additional behavior (like toString())
It may also have:
A no-argument constructor
A parameterized constructor
Properties of a POJO
A class is considered a POJO if it does not:
Extend any predefined class (e.g., HttpServlet, EntityBean, etc.)
Implement any predefined interface (e.g., javax.ejb.EntityBean)
Contain framework-specific annotations (e.g., @entity , @Component)
Example
public class Employee {
private int id ; private String name ;
// Default constructor public Employee…