Encapsulation, JAVA Programming

Assignment Help:

Defines to keeping all the related members together in an object. Specifying member variables as private may hide the methods and variables. Objects should hide their inner workings from the outside part. Good encapsulation gives code modularity by preventing objects interacting with each other in an unexpected way, which in turn builds future development and refactoring efforts easy.

 

931_Untitled.png

 

Being able to encapsulate members of a class is important for integrity and security. We may protect variables from unacceptable values. The sample code above describes how encapsulation may be used to protect the MyMarks object from having negative values. Any modification to member variable "vmarks" can only be laid out through the setter method setMarks(int mark). This prevents the object "MyMarks" from needing any negative values by throwing an exception.

 


Related Discussions:- Encapsulation

Jdbc, creating connection which will authenciate for a password

creating connection which will authenciate for a password

What are the benefits of spring framework, The benefits of Spring are as fo...

The benefits of Spring are as follows: ? Spring has layered architecture. Use what you require and leave you don't require now. ? Spring Enables POJO Programming. There is no

Explain the three benefits of access protection, Explain the Three Benefits...

Explain the Three Benefits of Access Protection ? Access protection has three major benefits: 1. It permits you to enforce constraints on an object's state. 2. It gives a si

I need liferay especialist, I need Liferay Especialist Project Descripti...

I need Liferay Especialist Project Description: We want a JAVA + JSF + Portlets expert Liferay expertise is needed Big Data and Online Tools + Multilingual Portal & Websit

I want customize tumblr theme, I need Customize Tumblr theme Project Des...

I need Customize Tumblr theme Project Description: I have a blog here I would like to customize it as follows; 1) Modify the horizontal navigation from the bottom of th

Confidentiality and privacy - security, The confidentiality and privacy may...

The confidentiality and privacy may be accomplished through encryption. Encryption may be: Private-key or symmetric: This is based on a single key. This needs the sender and the

Why we avoiding short circuits, Why we Avoiding Short Circuits ? If you...

Why we Avoiding Short Circuits ? If you need all of your boolean expressions evaluated regardless of the truth value of each, then you can use & and | instead of && and ||. The

Need android - ios pdf reader, Project Description: Our project consists...

Project Description: Our project consists of a plain application, both for iPad/iOS (Newsstand app) and Android 4.x which will download PDF magazines from the internet, after ha

What are trojan horses, What are Trojan Horses? Trojan Horses are unlik...

What are Trojan Horses? Trojan Horses are unlike viruses usually they are stand-alone programs. The look such as what they are not. They appear to be something harmless and int

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd