answersLogoWhite

0

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

15y ago

What else can I help you with?

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.


Encapsulation in vb.net?

Encapsulation in VB.NET is a fundamental concept of object-oriented programming that restricts direct access to an object's data and methods, promoting data hiding. It is achieved through access modifiers such as Private, Public, and Protected, which control the visibility of class members. By using properties, developers can expose data in a controlled manner, allowing for validation and logic to be implemented when getting or setting values. This helps maintain the integrity of the data and promotes a clear interface for interaction with the 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 Encapulation?

Encapsulation is a fundamental concept in object-oriented programming that involves bundling the data (attributes) and methods (functions) that operate on that data within a single unit or class. It restricts direct access to some of an object's components, which helps to protect the integrity of the data and prevent unintended interference. By using access modifiers (like private, public, and protected), encapsulation promotes modularity and enhances code maintainability. This principle allows developers to expose only the necessary parts of an object while hiding its internal workings.


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.

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.


Encapsulation in vb.net?

Encapsulation in VB.NET is a fundamental concept of object-oriented programming that restricts direct access to an object's data and methods, promoting data hiding. It is achieved through access modifiers such as Private, Public, and Protected, which control the visibility of class members. By using properties, developers can expose data in a controlled manner, allowing for validation and logic to be implemented when getting or setting values. This helps maintain the integrity of the data and promotes a clear interface for interaction with the object.


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.


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.


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 Encapulation?

Encapsulation is a fundamental concept in object-oriented programming that involves bundling the data (attributes) and methods (functions) that operate on that data within a single unit or class. It restricts direct access to some of an object's components, which helps to protect the integrity of the data and prevent unintended interference. By using access modifiers (like private, public, and protected), encapsulation promotes modularity and enhances code maintainability. This principle allows developers to expose only the necessary parts of an object while hiding its internal workings.


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 are the different types of access modifiers?

Access modifiers are keywords in programming that define the accessibility of classes, methods, and variables. The main types include public, which allows access from anywhere; private, restricting access to within the same class; protected, permitting access to subclasses and classes in the same package; and default (no modifier), which allows access only within the same package. These modifiers help encapsulate data and control how components of a program interact with each other.


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.


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.