answersLogoWhite

0


Best Answer

a class can control what information or data can be accessible by other classes

access modifiers sets usability of the methods defined in the class by other classes in either the same package or the other,

this is how acces modifiers encapsulates the variables or the methods from being used .

like there are 3 access modifiers--

1.protected-can be used in the same class or class which has inherited it .

2.default-can be used in the same package,but no acces to other classes.

3.public-can be used by classes in different package.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How is encapsulation linked with access modifiers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is access modifier?

An Access Modifier is a key word in java that determines what level of access or visibility a particular java variable/method or class has. There are 4 basic access modifiers in java. They are: 1. Public 2. Protected 3. Default and 4. Private Private is the most restrictive access modifier whereas public is the least restrictive. Default is the access protection you get when you do not specifically mention an access modifier to be used for a java object.


Discuss about the visibility control of java program?

Visibility is another term used for Acess Specifiers for java variables and objects.One of the techniques in object-oriented programming is encapsulation. It concerns the hiding of data in a class and making them available only through its methods. In this way the chance of making accidental mistakes in changing values is minimized. Java allows you to control access to classes, methods, and fields via so-called access specifiers. The access to classes, constructors, methods and fields are regulated using access modifiers i.e. a class can control what information or data can be accessible by other classes. To take advantage of encapsulation, you should minimize access whenever possible.Java provides a number of access modifiers to help you set the level of access you want for classes as well as the fields, methods and constructors in your classes. A member has package or default accessibility when no accessibility modifier is specified.Access Modifiers1. Private2. Protected3. Default4. PublicPublic is the most liberal access specifier and Private is the most restrictive access specifier.


What is the explanation for the different access modifiers in Java?

An Access Modifier is a key word in java that determines what level of access or visibility a particular java variable/method or class has. There are 4 basic access modifiers in java. They are:PublicProtectedUnspecified (package-private)PrivateClasses can only be declared public or left unspecified (the "package-private" default level). Methods can be declared any of the above.See the Link on the Java Tutorial for a very good explanation of the various levels of access each modifier provides.


Do you get Security by access specifiers in Java?

No, because there is no such thing as an access specifier in Java. There are access modifiers, and security is their entire purpose, so of course you get it when you use them.


Define access specifiers in object oriented programming?

One of the techniques in object-oriented programming is encapsulation. It concerns the hiding of data in a class and making them available only through its methods. In this way the chance of making accidental mistakes in changing values is minimized. Java allows you to control access to classes, methods, and fields via so-called access modifiers. The access to classes, constructors, methods and fields are regulated using access modifiers i.e. a class can control what information or data can be accessible by other classes. To take advantage of encapsulation, you should minimize access whenever possible.Java provides a number of access modifiers to help you set the level of access you want for classes as well as the fields, methods and constructors in your classes. A member has package or default accessibility when no accessibility modifier is specified.Access Modifiers1. Private2. Protected3. Default4. PublicPublic is the most liberal access modifier and Private is the most restrictive access modifier. NB there is no such thing as an 'access specifier' in Java, only access modifiers.

Related questions

What is access modifier?

An Access Modifier is a key word in java that determines what level of access or visibility a particular java variable/method or class has. There are 4 basic access modifiers in java. They are: 1. Public 2. Protected 3. Default and 4. Private Private is the most restrictive access modifier whereas public is the least restrictive. Default is the access protection you get when you do not specifically mention an access modifier to be used for a java object.


Advantage of object oriented programmings?

Some advantages of object oriented programming are: a. The code is easier to organize and maintain b. Chances of logic errors are reduced c. Code redundancy is avoided because of inheritance d. Unwanted code access is avoided by using access modifiers and encapsulation e. Etc.


What mean encapsulation?

To encapsulate means to place in a capsule, or container, or more generally within some sort of sealed enclosure.Java ProgrammingEncapsulation concerns the hiding of data in a class and making them available only through its methods. In this way the chance of making accidental mistakes in changing values is minimized. Java allows you to control access to classes, methods, and fields via so-called access specifiers. The access to classes, constructors, methods and fields are regulated using access modifiers i.e. a class can control what information or data can be accessible by other classes. To take advantage of encapsulation, you should minimize access whenever possible.


Discuss about the visibility control of java program?

Visibility is another term used for Acess Specifiers for java variables and objects.One of the techniques in object-oriented programming is encapsulation. It concerns the hiding of data in a class and making them available only through its methods. In this way the chance of making accidental mistakes in changing values is minimized. Java allows you to control access to classes, methods, and fields via so-called access specifiers. The access to classes, constructors, methods and fields are regulated using access modifiers i.e. a class can control what information or data can be accessible by other classes. To take advantage of encapsulation, you should minimize access whenever possible.Java provides a number of access modifiers to help you set the level of access you want for classes as well as the fields, methods and constructors in your classes. A member has package or default accessibility when no accessibility modifier is specified.Access Modifiers1. Private2. Protected3. Default4. PublicPublic is the most liberal access specifier and Private is the most restrictive access specifier.


What is an access specifier do?

There is no such thing as an access specifier in Java. There are access modifiers. They specify the access level of the item they modify: public, private, protected.


What does it mean by encapsulation?

Encapsulation makes class fields private, preventing access to it from outside of the class. Essentially, this data is hidden from the rest of the program. It is possible to allow access to the fields via public methods.


What is the explanation for the different access modifiers in Java?

An Access Modifier is a key word in java that determines what level of access or visibility a particular java variable/method or class has. There are 4 basic access modifiers in java. They are:PublicProtectedUnspecified (package-private)PrivateClasses can only be declared public or left unspecified (the "package-private" default level). Methods can be declared any of the above.See the Link on the Java Tutorial for a very good explanation of the various levels of access each modifier provides.


Do you get Security by access specifiers in Java?

No, because there is no such thing as an access specifier in Java. There are access modifiers, and security is their entire purpose, so of course you get it when you use them.


Define access specifiers in object oriented programming?

One of the techniques in object-oriented programming is encapsulation. It concerns the hiding of data in a class and making them available only through its methods. In this way the chance of making accidental mistakes in changing values is minimized. Java allows you to control access to classes, methods, and fields via so-called access modifiers. The access to classes, constructors, methods and fields are regulated using access modifiers i.e. a class can control what information or data can be accessible by other classes. To take advantage of encapsulation, you should minimize access whenever possible.Java provides a number of access modifiers to help you set the level of access you want for classes as well as the fields, methods and constructors in your classes. A member has package or default accessibility when no accessibility modifier is specified.Access Modifiers1. Private2. Protected3. Default4. PublicPublic is the most liberal access modifier and Private is the most restrictive access modifier. NB there is no such thing as an 'access specifier' in Java, only access modifiers.


What is class modifiers in java?

Class Modifiers are access modifiers that specify the accessibility levels of a class. There are 4 basic access modifiers in java. They are: 1. Public 2. Protected 3. Default and 4. Private Java programming does not run by just a single piece of class that has the whole functionality. You have hundreds of classes that interact with one another, passing data between them and returning output to the user of the system. So it is very important for members of one class to access members of another. Here members may refer to variables, methods and even classes. So, this is where the access modifiers come into picture. The modifier associated with every member of the class determines what level of visibility that member has.


What is the name of the process of building a frame around network layer information?

Encapsulation. Actually, this is one type of encapsulation; encapsulation occurs at several layers.Encapsulation. Actually, this is one type of encapsulation; encapsulation occurs at several layers.Encapsulation. Actually, this is one type of encapsulation; encapsulation occurs at several layers.Encapsulation. Actually, this is one type of encapsulation; encapsulation occurs at several layers.


Is it true that wrapping up of data of different types into a single unit is known as encapsulation?

Not quite. Encapsulation means to combine data and the methods that work upon that data into a single unit (an object), such that access to both the data and methods is restricted in a controlled manner. Data-hiding is fundamental to encapsulation.