POJI & POJO
POJI :-
If a java interface is not coupled with any technology (or) any frame work then such java interface is called “POJI” (plain old java interface).
EX:-
1. public interface MyInter
{
---------------
}
-> MyInter is POJI
2. Public interface MyInter extends Serializable
{
-----------------
}
-> MyInter is a POJI because Serializable is a core interface of java.
3. Public interface Suresh
{
----------------
}
Public interface MyInter extends Suresh
{
---------------
}
->MyInter is a POJI because Suresh is a user defined interface.
4. Public interface Suresh extends javax.servlet.Servlet
{
----------------------
}
Public interface MyInter extends suresh
{
-----------------
}
->MyInter is not a POJI because suresh is not a POJI.
5. Public interface MyInter extends java.rmi.Remote
{
-------------------
}
->MyInter is not a POJI because Remote is an RMI technology.
EX:-
1. public interface MyInter
{
---------------
}
-> MyInter is POJI
2. Public interface MyInter extends Serializable
{
-----------------
}
-> MyInter is a POJI because Serializable is a core interface of java.
3. Public interface Suresh
{
----------------
}
Public interface MyInter extends Suresh
{
---------------
}
->MyInter is a POJI because Suresh is a user defined interface.
4. Public interface Suresh extends javax.servlet.Servlet
{
----------------------
}
Public interface MyInter extends suresh
{
-----------------
}
->MyInter is not a POJI because suresh is not a POJI.
5. Public interface MyInter extends java.rmi.Remote
{
-------------------
}
->MyInter is not a POJI because Remote is an RMI technology.
POJO :-
If a java class is not coupled with any technology (or) any frame work then that java class is called “POJO”.
Coupling with technology (0r) frame work means a java class should not extend a base class of a technology (Or) a frame work.
Ex:-
1. Public Demo
{
---------------
}
-->Demo is a POJO class because POJO class may not be public.
2. Public class Test
{
---------------
}
Public class Demo extends Test
{
---------------
}
-->Demo is a POJO because Test is a POJO.
3. Public class Test implements serializable
{
---------------
}
Public class Demo extends Test
{
---------------
}
-->Demo is a POJO because Test is a POJO.
4. Public class Test implements javax.servlet.Servlet
{
---------------
}
Public class Demo extends Test
{
---------------
}
-->Demo is not a pojo because Test is not a POJO.
5. Public interface xyz
{
---------------
}
public class Demo implements xyz
{
---------------
}
-->Demo is a POJO because xyz is a POJI (This is called POJI/POJO model)
6. Public class Demo
{
Public Demo (intx,inty)
{ }
}
-->Demo is a POJO because a POJO may contain a constructor without arg (Or) with arg (or) both.
Coupling with technology (0r) frame work means a java class should not extend a base class of a technology (Or) a frame work.
Ex:-
1. Public Demo
{
---------------
}
-->Demo is a POJO class because POJO class may not be public.
2. Public class Test
{
---------------
}
Public class Demo extends Test
{
---------------
}
-->Demo is a POJO because Test is a POJO.
3. Public class Test implements serializable
{
---------------
}
Public class Demo extends Test
{
---------------
}
-->Demo is a POJO because Test is a POJO.
4. Public class Test implements javax.servlet.Servlet
{
---------------
}
Public class Demo extends Test
{
---------------
}
-->Demo is not a pojo because Test is not a POJO.
5. Public interface xyz
{
---------------
}
public class Demo implements xyz
{
---------------
}
-->Demo is a POJO because xyz is a POJI (This is called POJI/POJO model)
6. Public class Demo
{
Public Demo (intx,inty)
{ }
}
-->Demo is a POJO because a POJO may contain a constructor without arg (Or) with arg (or) both.
Comments
Visitors