answersLogoWhite

Top Answer
User Avatar
Wiki User
Answered
2007-12-20 06:57:19
2007-12-20 06:57:19

We use these keywords to specify access levels for member variables, or for member functions (methods). Public variables, are variables that are visible to all classes. Private variables, are variables that are visible only to the class to which they belong. Protected variables, are variables that are visible only to the class to which they belong, and any subclasses.

Deciding when to use private, protected, or public variables is sometimes tricky. You need to think whether or not an external object (or program), actually needs direct access to the information. If you do want other objects to access internal data, but wish to control it, you would make it either private or protected, but provide functions which can manipulate the data in a controlled way

001
๐Ÿฆƒ
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
๐Ÿ˜‚
0

Related Questions


"Inheritance" has nothing to do with "access modifiers". So there is no public inheritance or private inheritance


The different types of access modifiers are:publicprivateprotecteddefault (package)


There is no private or protected specifier in C. It is a C++ concept.


Data hiding is the process by which access modifiers are used to hide the visibility of java methods and variables. They access modifiers are: public, private and protected. Abstraction is the process by which we define a specific behavior by beans of abstract classes and methods which form the skeleton for any class that would be extending this class.


Public, Private and Protected "keywards/ access modifiers" are used similarly as they are with variables. Protected variables, methods or class CAN ONLY be used by an inherited class.


A private variable is only accessible in the class where it was declaredA protected variable is accessible to sub classes and classes in the same package as where they were declared


Private members are accessible to the class and friends of the class. Protected members are also accessible to derived classes.


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.


A private member of a class can only be accessed by methods of that class. A protected member of a class can only be accessed by methods of that class and by methods of a derived class of that class.


the access modifiers are private ,public, private..........


hey whats the difference between public and private company?


A top-level class in Java may be declared with one or more modifiers:Access modifiers: public or package-private (no explicit modifier).Modifier requiring override: abstractModifier prohibiting value modification: finalModifier forcing strict floating point behavior: strictfpAnnotationsTop-level classes cannot be static and not all combinations of modifiers are allowed; e.g. class cannot be declared both abstract and final.Access level modifiers at the member level-public, private, protected, or package-private (no explicit modifier).


There are four different visibility (access) modifiers in Java: # public - Any class can access this field. # protected - Any class in the same package as this one, as well as any subclass of this class, can access this field. # (no modifier) - Any class in the same package as this one can access this field. # private - Only the class to which this field belongs can access it. So specifically for protected fields, it means that you add the ability for all subclasses of this class to directly access the field. (See the simple chart in the related link.)


The public, protected, and private keywords are access modifiers that specify if the item they modify can be accessed inside or outside the class or a derived class.A public item is fully accessible, inside or outside the class, including inside a derived class.A protected item is accessible only inside the class or inside a derived class.A private item is accessible only inside the class.



What is the difference between private stafford and plus student loans?


Difference between public and private administration



Private means that the member data or function cannot be accessed by code outside of the containing class. Protected means that the member data or function cannot be accessed by code outside of the containing class or outside of a class that inherits the class.


These are all access modifiers in Java. a. Public - these are accessible anywhere. This is the least restrictive access specifier. b. Private - these are accessible only inside the declaring class. This is the most restrictive access specifier. c. Protected - these are in between public and private. These are accessible to all classes that inherit this class d. Package - this is the default access specifier. These are accessible to all classes that are present in the same package as the contained class.





The main difference between state and private exchanges under the Affordable Healthcare Act is that state exchanges are run by the government, and private exchanges aren't.


An Access Specifier or an Access Modifier is a keyword that determines the visibility of that entity under consideration. The different access modifiers in Java are:PublicPrivateProtectedDefaultPublic is the least restrictive access specifier whereas private is the most restrictive



Copyright ยฉ 2020 Multiply Media, LLC. All Rights Reserved. The material on this site can not be reproduced, distributed, transmitted, cached or otherwise used, except with prior written permission of Multiply.