Preview

OOP Mwaks

Good Essays
Open Document
Open Document
6094 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
OOP Mwaks
Describe any two access modifiers as used in java programming language, write a sample java code to show how each can be used.
Private Access Modifier - private:
Methods, Variables and Constructors that are declared private can only be accessed within the declared class itself. Private access modifier is the most restrictive access level. Class and interfaces cannot be private. Variables that are declared private can be accessed outside the class if public getter methods are present in the class. Using the private modifier is the main way that an object encapsulates itself and hide data from the outside world.
Example:
The following class uses private access control: public class Logger { private String format; public String getFormat() { return this.format; } public void setFormat(String format) { this.format = format; }
}
Public Access Modifier - public:
A class, method, constructor, interface etc declared public can be accessed from any other class. Therefore fields, methods, blocks declared inside a public class can be accessed from any class belonging to the Java Universe.
Example:
The following function uses public access control: public static void main(String[] arguments) { // ...
}
The main() method of an application has to be public. Otherwise, it could not be called by a Java interpreter (such as java) to run the class.
Protected Access Modifier - protected:
Variables, methods and constructors which are declared protected in a superclass can be accessed only by the subclasses in other package or any class within the package of the protected members' class. The protected access modifier cannot be applied to class and interfaces. Methods, fields can be declared protected, however methods and fields in a interface cannot be declared protected.
Protected access gives the subclass a chance to use the helper method or variable, while preventing a nonrelated class from trying to use it.
Explain why java can be written and

You May Also Find These Documents Helpful

  • Good Essays

    • Design Element Security - this level corresponds to limitations stated in access control list for design element (i.e. who may work with this design element).…

    • 767 Words
    • 4 Pages
    Good Essays
  • Good Essays

    Nt1330 Unit 1 Assignment

    • 711 Words
    • 3 Pages

    During operation, the system uses the access control rules to decide whether access requests consumers shall be approved or disapproved. Resources include individual files or items data, computer programs, computer devices and functionality provided by computer applications. Examples of consumers are computer users, computer programs and other devices on the…

    • 711 Words
    • 3 Pages
    Good Essays
  • Good Essays

    If multiple people need access to one file, this is commonly done by placing the users into groups, and assigning the groups and users various levels of permission access. There is a hierarchy where groups are on top and access control lists are underneath. The groups are owner class, group class, and other class. The other privileges are read, write, and execute. When a user creates a file, they are automatically made the owner. They can grant others into the group class and other class. Directory lists have 10 spaces or bits on the left hand side. The first space on the left is either a ‘-‘ for file, or a ‘D’ for directory. Stallings (2012) stated,“ Nine of the protection bits specify read (r), write (w), and execute (x) permission for the owner of the file, other members of the group to which this file belongs, and all other users” (p.558). The first three are for owner, next three are for group and last three are for other.…

    • 680 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    07: Password and Ref

    • 4381 Words
    • 33 Pages

    Object privileges allow users to perform DML operations on the data contained within database objects.…

    • 4381 Words
    • 33 Pages
    Satisfactory Essays
  • Powerful Essays

    All teachers have authority over all students, not just those assigned to their class. Additionally, students are expected to work during class time and follow teacher direction. Malicious destruction of school property results in the replacement, repair or payment for damages by either the student or his/her parents. The placement of stickers or writing on school property is forbidden. Computer equipment is considered school property.…

    • 10347 Words
    • 52 Pages
    Powerful Essays
  • Satisfactory Essays

    Database Concepts Pt2520

    • 326 Words
    • 2 Pages

    12. TRUE User access refers to what objects and data in a database a user has permissions to use.…

    • 326 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    lab 4

    • 503 Words
    • 2 Pages

    The type of access controls and permissions that are probably configured are Modify , Read or Full control.…

    • 503 Words
    • 2 Pages
    Good Essays
  • Powerful Essays

    Access control rules and procedures are required to regulate who can access IDI information resources or systems and the associated access privileges. This policy applies at all times and should be adhered to whenever accessing IDI information in any format, and on any device.…

    • 1356 Words
    • 5 Pages
    Powerful Essays
  • Satisfactory Essays

    Unit 3 Assignment 3

    • 288 Words
    • 1 Page

    The Classification are assigned to only specific people, for example a manager would have access to restricted information, as for an employee would not have that type of authorization. The employee would only have access to public information. It is important to have these types of data classification polices to prevent classified information from leaking. To ensure adequate quality standards, the classification process has to be monitored by an expert.…

    • 288 Words
    • 1 Page
    Satisfactory Essays
  • Better Essays

    Questions 641 Answers

    • 1208 Words
    • 6 Pages

    For the five examples given, explain what each one protects in the first column and what it Doesn’t protect in the second column.…

    • 1208 Words
    • 6 Pages
    Better Essays
  • Satisfactory Essays

    unit 7 assignment 1

    • 547 Words
    • 2 Pages

    If I were to develop a simple classification plan for the school system WLAN, it would involve four categories: Private, sensitive, restricted, and proprietary. Depending on the…

    • 547 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    True False

    • 378 Words
    • 2 Pages

    12. User access refers to what objects and data in a database a user has permission to use.…

    • 378 Words
    • 2 Pages
    Good Essays
  • Better Essays

    Confidentiality: data is only accessed by people who have the right to view the information.…

    • 1186 Words
    • 5 Pages
    Better Essays
  • Satisfactory Essays

    It means keep information private and safe. It can include that you would have to passing on private information with the permission individual’s permission or only passing on information…

    • 585 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Database Sql Server

    • 328 Words
    • 2 Pages

    User access refers to what objects and data in a database a user has permissions to use. True…

    • 328 Words
    • 2 Pages
    Satisfactory Essays

Related Topics