Explain Mutator method

Mutator method: It is a method specifically designed to permit controlled modification of a private attribute of a class. By convention, we name the mutators with a set prefix obeyed by the name of the attribute being transformed. For example, the mutator for an attribute named speed would be setSpeed. By creating an attribute private, we save objects of other classes from modifying its value other than via its mutator. The mutator is capable to check the value being employed to transform the attribute and reject the modification when essential. Moreover, modification of one attribute may need others to be transformed in order to keep the object in a reliable state. A mutator technique can undertake this role. Mutators are employed both to grant safe access to the value of the private attribute and to save attributes from modification by objects of the other classes. The later goal is accomplished by selecting a suitable visibility for the mutator.

   Related Questions in Programming Languages

  • Q : What is Bit manipulation operator Bit

    Bit manipulation operator: Operators, like &, | and ^, which are employed to examine and manipulate individual bits win the bytes of a data item. The shift operators, <<, >> and >>>, are too bit manipulation operators.

  • Q : Explain the steps to design product If

    If not in production, how far did you obey the design and why did not you notice it in production?

  • Q : Differences between XHTML and HTML

    Explain the differences between XHTML and HTML?

  • Q : Explain Inheritance hierarchy

    Inheritance hierarchy: The relationship among super-classes and sub-classes is termed as an inheritance hierarchy. The single inheritance of classes means that each and every class has simply a single `parent' class and that Object class is the eventu

  • Q : Define Hardware Hardware : It is the

    Hardware: It is the physical devices of a computer system, like its micro-chips, keyboard, disk drives, printer, sound card, and so forth. It is termed `hardware' in contrary to programs, which are termed `software'.

  • Q : Main purpose of Child Header files

    Illustrate what is the main purpose of Child Header files?

  • Q : Define the term Manifest file Define

    Define the term Manifest file: It is a file which is held in a Java Archive (JAR) file, explaining the contents of the archive.

  • Q : What is no-arg constructor no-arg

    no-arg constructor: It is a constructor which takes no arguments. By default, each and every class without an explicit constructor has a default no-arg constructor with the public access. Its role is entirely to invoke the no-arg constructor of the in

  • Q : Describe the Binders Briefly describe

    Briefly describe the Binders?

  • Q : Explain Return statement Return

    Return statement: It is a statement employed to terminate the execution of the method. The method with void return type might only have return statements of the form as: return;

©TutorsGlobe All rights reserved 2022-2023.