what is pojo class in java

11 months ago 44
Nature

A POJO (Plain Old Java Object) is a regular Java object with no special restrictions other than those forced by the Java Language Specification. It is an object class that encapsulates business logic and is not bound by any specific framework or naming convention for its properties and methods. POJOs are used to increase the readability and reusability of a program. They were introduced in EJB 3.0 by Sun Microsystems.

POJOs have gained the most acceptance because they are easy to write and understand. They do not require any special classpath or dependencies, which makes them easy to develop, test, and maintain. POJOs are used in Model View Controller (MVC) architecture, where the controller interacts with the business logic, which contacts the POJO class to access the data.

A POJO should not extend prespecified classes or implement prespecified interfaces. POJOs are different from JavaBeans, which are Java classes that follow specific naming conventions and have getter and setter methods for their properties. POJOs can be converted into JavaBeans, but this can have limitations.

In summary, a POJO is a simple Java object that encapsulates business logic and is not bound by any specific framework or naming convention for its properties and methods. It is used to increase the readability and reusability of a program and is easy to develop, test, and maintain.