Describe about the term access protection, JAVA Programming

Assignment Help:

Describe about the term Access Protection ?

Global variables are a typical cause of bugs in most programming languages. A few unknown function can modify the value of a variable while the programmer isn't expecting it to change. This plays all sorts of havoc.

Most OOP languages involving Java permit you to protect variables from external modification. This permit you to guarantee in which your class remains consistent along with what you think it is as long as the techniques of the class themselves are bug-free. For instance, in the Car class we'd like to make sure that no block of code in a few other class is permited to make the speed greater than the maximum speed. We need a way to make the subsequent illegal:

Car c = new Car("New York A234 567", 100.0);
c.speed = 150.0;
This code violates the constraints we've placed on the class. We need to permit the compiler to enforce these constraints.

A class presents a picture of itself to the world. (This picture is sometimes known as an interface, other than the word interface has a more exact meaning in Java.) This picture says in which the class has certain methods and certain fields. Everything else about the class involved the detailed workings of the class's methods are hidden. As long as the picture the class displays to the world doesn't change, the programmer can change how the class implements that picture. Among other advantages this permit the programmer to change and improve the algorithms a class uses without worrying that a few piece of code depends in unforeseen ways on the details of the algorithm used. This is known as encapsulation.

Another way to think about encapsulation is in which a class signs a contract along with all the other classes in the program. This contract says in which a class has methods with unambiguous names that take particular types of arguments and return a particular type of value. The contract might also say that a class has fields along with given names and of a given type. However the contract does not specify how the methods are implemented. However, it does not say that there aren't other private fields and methods that the class may use. A contract guarantees the presence of certain methods and fields. It does not exclude all other techniques and fields. This contract is implemented by access protection. Every class, field and techniques in a Java program is defined as either public, private, protected or unspecified.

You're closer to your immediate family (your parents and your children) than you are to your cousins. You're closer to your cousins than to the common public at large, but there are some things you don't tell anybody. Therefore, your family is not my family.


Related Discussions:- Describe about the term access protection

Project, online shopping project

online shopping project

I need viral script for facebook likes, Project Description: I need a Sc...

Project Description: I need a Script developer who can make script for me. Need urgently. Skills required: Java, Facebook Marketing, Javascript, PHP, Script Install

SWING, Application using Swing API

Application using Swing API

Decoding program, 699906626330444777707776662233777 decoding program

699906626330444777707776662233777 decoding program

Cross platform stock market game, Cross platform stock market game Proje...

Cross platform stock market game Project Description: I want someone to develop a simple stock market game. This will mainly be a facebook and android app, face book being mo

Illustrate the parser method, Illustrate the parser method The below ta...

Illustrate the parser method The below table summarizes the parser methods available to a java programmer.

File and random access file classes, Difference between the File and Random...

Difference between the File and Random Access File classes? Ans) The File class encapsulates the files and directories of the local file system. The Random Access File class giv

Code java and javascript in liferay, We need a serious programmer who will ...

We need a serious programmer who will code Java and Javascript in Liferay - open to bidding Project Description: Big Data project Prototype in Liferay. Big Data + User onl

Develop a java application, Modules of software: 1 - Serial RS232 comm p...

Modules of software: 1 - Serial RS232 comm port comunication 2 - NanoHTTPD serving some processed pages 3 - System tray application to indicate status and access configura

I clicker, i am to find 75% of i clicker score.Each correct answer is worth...

i am to find 75% of i clicker score.Each correct answer is worth 2points and an incorrect 1point. Express grade as a percentage (i.e the max is 100%). e.g 1 no i clicker question

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