Define Accessor method

Accessor method: A technique specifically designed to offer access to a private attribute of a class. By convention, we name accessors with a get prefix followed by the name of the attribute being accessed. For example, the accessor for an attribute named speed would be ‘getSpeed’. By creating an attribute private, we save objects of other classes from varying its value other than via a mutator method. The Accessors are employed both to grant safe access to the value of a private attribute and to save attributes from inspection by the objects of other classes. The later goal is attained by selecting a suitable visibility for the accessor.

   Related Questions in Programming Languages

  • Q : Explain the way to create a Mutex

    Explain the way to create a Mutex.

  • Q : Define Class Class : It is a

    Class: It is a programming language concept which permits data and techniques to be grouped altogether. The class concept is basic to the notion of an object-oriented programming language. Methods of a class define the set of permitte

  • Q : Functions of System calls Show what are

    Show what are the different functions of System calls?

  • Q : Mission Critical Systems or a real-time

    Determine the important aspect of Mission Critical Systems or a real-time system.

  • Q : Explain Static variable Static variable

    Static variable: It is a static variable defined within a class body. Such a variable fits in to the class as a whole, and is, thus, shared by all objects of the class. The class variable may be employed to define the default value of an instance vari

  • Q : Define Divide and conquer Divide and

    Divide and conquer: An approach to trouble solving which attempts to decrease an overall single big trouble into multiple simpler troubles.

  • Q : Define the term Instance Define the

    Define the term Instance: It is a synonym for object. The objects of a class are instantiated whenever a class constructor is invoked through the new operator.

  • Q : What is an Import statement Import

    Import statement: A statement which makes the names of one or more interfaces or classes accessible in a different package from the one in which they are stated. Import statements pursue any package declaration {package!declaration}, and precede any i

  • Q : Explain Semantic error Semantic error:

    Semantic error: It is an error in the meaning of program. A statement might contain no syntax errors, however might still break the rules of Java language. For example, when ivar is an int variable, the shown statement is syntactically correct

  • Q : Explain Branch instruction Branch

    Branch instruction: It stores a new instruction address into the program counter. The consequence of this is the next instruction to be fetched will not generally be the one instantly following the branch instruction. Therefore the normal chronologica

©TutorsGlobe All rights reserved 2022-2023.