Wednesday, November 2, 2016

What are POJO and POJI ?

A POJO class is  simple java class with Setter & Getter   Methods but, it is  neither Implemented nor Extended from any Technology Specific Interface or Class Respectively.

Ex:                                                                                        
public class  a{                    
    //Setters & Getters                              
}                                              
class a  is POJO class.


 public class  b implements java.io.Serializable{
         //Setters & Getters
  }
class  is POJO class(Because  of 'Serializable' is part of J2SE [not a Technology]).

 public class  b implements java.sql.Connection{
         //Setters & Getters
  }
class b is not POJO class(Because  of 'Connection' is part of JDBC Technology).


public class  c extends Thread{
         //Setters & Getters
  }
class  is POJO class(Because  of 'Thread' is part of J2SE [not a Technology]).

public class  c extends HttpServlet{
         //Setters & Getters
  }
class  is not POJO class(Because  of 'HttpServlet' is part of Servlet Technology]).


"A Java Interface Which does not extends from any Technology Specific Interfaces is Called POJI".

Eg:                                                                                                          

public interface I {                   public interface J extends I{
//Method Declaration.                    //Method Declaration.                    
}                                                     }
Here interface I and J are POJIs.

public interface k extends java.rmi.Remote{
//Method Declaration.                    
}                                          
Here K is not POJI Because 'Remote' is a part of rmi Technology.


Share:

1 comment: