I started learning Spring Framework, the term pojo is coming so many times, and I am confused what the difference between a normal (Animal a1=new Animal()) object and a pojo object ...
Can any one explain me what is Pojo in java?
9.3k views Asked by Chanky Mallick At
4
There are 4 answers
2
On
- POJO, or Plain Old Java Object, is a normal Java object class (that is, not a JavaBean, EntityBean etc.)
- It does not serve any other special role nor does it implement any special interfaces of any of the Java frameworks.
- This term was coined by Martin Fowler, Rebbecca Parsons and Josh MacKenzie who believed that by creating the acronym POJO, such objects would have a "fancy name", thereby convincing people that they were worthy of use.
0
On
In simple terms There is no difference between a normal (Animal a1=new Animal()) object and a pojo object except that Animal class could have other methods and could extend or implement other class or interface respectively but POJO class only has getter, setter method and does not extend or implement prespecified classes or interfaces.
POJO(Plain Old Java Object) is nothing but a simple java class which has attributes(Variables) and their getter setter methods to manage pojo objects.
Pojo
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 toBasically a class with attributes and it's getters and setters.