Explain the Encapsulation principle.

By: Karthik Printer Friendly Format    

Answer: Encapsulation is a process of binding or wrapping the data and the codes that operates on the data into a single entity. This keeps the data safe from outside interface and misuse. One way to think about encapsulation is as a protective wrapper that prevents code and data from being arbitrarily accessed by other code defined outside the wrapper.



Most Viewed Articles (in Interview )

Interview Question: How many EJB Objects are created for a Bean?

Question: What is a Hidden Comment in JSP?

Question: What is an output comment in JSP?

What is Collection API?

What is difference between Java Bean and Enterprise Java Bean?

Can Entity Beans have no create() methods?

Interview Question: What is Struts?

Interview Question: How is the MVC design pattern used in Struts framework?

Interview Question: Does Struts include its own unit tests?

Interview Question: Why aren't the Struts tags maintained as part of the Jakarta Taglibs project ?

Interview Question: What is ActionServlet?

Interview Question: Can I invoke Runtime.gc() in an EJB?

Interview Question: Why does EJB needs two interfaces(Home and Remote Interface)?

Interview Question: What is the difference between ejbCreate() and ejbPostCreate?

Interview Question: What is difference between EJB 1.1 and EJB 2.0?

Latest Articles (in Interview)

Comment on this tutorial