Encapsulation
It’s a process of wrapping datamember and function into a single unit is called Class and purpose of encapsulation is data hiding.
POJO :Plain old java object
POI : plain old interface
Java bean is a general purpose reusable piece of code which is having following characteristics from a normal class.
- Its should be in package.
- Its should be public and have public default constructor.
- The data member should be private.
- Its should have public getter setter method or properties method
- This class should not extends any specific class and implements any specific class but must implements Serializable.
Example:
public class Login{
private String name;
public void setName(String name){
this.name = name;
}
public void getName() {
return name;
}
}