what is pojo class code example
Example 1: what is pojo
It stands for Plain old Java Object
and basically we use it when we need to represent
some data as Java object. So to that we need to
create a Java class to represent it's data.
For example:
{ "name" : "ABC",
"gender : "Female",
"phone : 1234567890 }
So we can create a java object with this
3 data and encapsulate them (name, gender, phone)
and also we need to create constructor to
create object easily
So the idea is we want to create a class
and eventually we want it to turn into Json file
automatically. Without us doing anything.
Example 2: pojo in java
It stands for Plain old Java Object
and basically we use it when we need to represent
some data as Java object. So to that we need to
create a Java class to represent it's data.
For example:
{ "name" : "ABC",
"gender : "Female",
"phone : 1234567890 }
So we can create a java object with this
3 data and encapsulate them (name, gender, phone)
and also we need to create constructor to
create object easily
So the idea is we want to create a class
and eventually we want it to turn into Json file
automatically. Without us doing anything.
Example 3: pojo class
It stands for Plain old Java Object
and basically we use it when we need to represent
some data as Java object. So to that we need to
create a Java class to represent it's data.
For example:
{ "name" : "ABC",
"gender : "Female",
"phone : 1234567890 }
So we can create a java object with this
3 data and encapsulate them (name, gender, phone)\
and also we need to create constructor to
create object easily
So the idea is we want to create a class
and eventually we want it to turn into Json file
automatically. Without us doing anything.