Preview

Computer Science Study Notes

Good Essays
Open Document
Open Document
1782 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Computer Science Study Notes
Computer Science Exam

Classes, Objects, and Methods
Attributes – data components of a class that provide and traits for the object of that class; also called fields, properties, and instance variables
Methods – code associated with an object in order to make it function and behave according to the class to which it belongs:
Constructor methods – to create or instantiate objects from the class definition
A default constructor will always be created and will initialize fields to 0, false, or null
Create your own constructor method with the same name as the default when the default values are not wanted, this is called overloading
Mutator/Accessor methods – to set and retrieve the instance variables/fields associated with each object that is created from the class

Mutators are used to directly access an object’s field to set it’s value
Mutator methods begin with the prefix “set” followed by the name of the corresponding instance variable
Mutators do not have a return value, void
Accessors are used to directly access an object’s field to get or retrieve it’s value
Accessor methods begin with the prefix “get” followed by the name of the corresponding instance variable
Accessors return this.variable

Behavior methods – to create the actions and functionality of the object
Class Header – made of three parts: access modifier, keyword class, name of class
Data Fields – or Instance variables, declared with private in order to protect data and hide information
This – refers to the current object being built, also helps to further distinguish between local variables from the parameter list and the object’s field variables
Encapsulation – the inclusion within an object of all the resources needed for the object to function, thought to be self-contained
Object Interface – how the client code can interact with an object through its public methods
Functional Decomposition – creating clearly defined behavioral/functional methods for a

You May Also Find These Documents Helpful

  • Satisfactory Essays

    4. What is a local variable? What statements are able to access a local variable?…

    • 765 Words
    • 5 Pages
    Satisfactory Essays
  • Satisfactory Essays

    The plant method design pattern generates a group of connected items instantiated by subclasses (University of Phoenix, 2005). This design pattern generates items without indicating the category of item that's to be generated. The plant method pattern describes a different way of producing items by using subclasses to override the derived kind of item that's to be generated.…

    • 579 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Attribute-Based Programming: Attributes assist you to add declarative information in your programs. This information can then be queried at runtime using reflection.…

    • 485 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Mat 540 Week 4 Paper

    • 1775 Words
    • 8 Pages

    Although the details can be quite complex, these details are the basic principles of object-oriented programming.…

    • 1775 Words
    • 8 Pages
    Powerful Essays
  • Good Essays

    A5: Constructors are used to initialize objects in java, at the time of object creation it is invoked. It provides data for an object that is why it is called a constructor. Constructor is automatically called immediately after the object is created, before the new operator completes. Constructors look a little strange because it has no return type, not even valid.…

    • 559 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Psy300 Week 8

    • 760 Words
    • 4 Pages

    • Think about this task in an object-oriented way, and identify the objects involved in the task.…

    • 760 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    a.x is available to code that is written outside the Sphere class. b.radius is not available to code written outside the Sphere class. c.radius, x, y, and z are called members of the Sphere class. d.z is available to code that is written outside the Sphere class.…

    • 1368 Words
    • 9 Pages
    Satisfactory Essays
  • Better Essays

    Plsql Chap7 Sols

    • 2330 Words
    • 17 Pages

    12. If there are values referenced continually in the application, storing them in packaged variables will allow the values to only be retrieved once thus saving data retrieval processing. The values in global constructs are persistent for the entire user session.…

    • 2330 Words
    • 17 Pages
    Better Essays
  • Satisfactory Essays

    These animals may have different habitats and they might be different animals but they have much more in common than you think. Humans started both of these animal issues, by not thinking about the habitats of these animal. They brought them to place where they didn’t know how to live and so they ended up destroying the environment around them. A good example is the goldfish. Their owners threw the goldfish into ponds and rivers, which was not their natural environment. Since this new environment did not have the things they were used to, they ate up all the native fish in the ponds and rivers. Now the native fish were dying, and the goldfish became huge and took up…

    • 407 Words
    • 2 Pages
    Satisfactory Essays
  • Better Essays

    iv. Names for Java classes follow the same rules as for variable names. It is convention that each word in the class name begins with an upper case letter.…

    • 939 Words
    • 4 Pages
    Better Essays
  • Satisfactory Essays

    functions and functionalities that are equipped in the item. the hard-to-find item information guidebook can also lie…

    • 1498 Words
    • 7 Pages
    Satisfactory Essays
  • Better Essays

    Element: Objects that possess the information the researcher seeks and about which the researcher will make inferences.…

    • 2105 Words
    • 9 Pages
    Better Essays
  • Satisfactory Essays

    Java Test

    • 469 Words
    • 2 Pages

    Q3. “ X extends Y “ is correct if and only if X is a class and Y is an interface.…

    • 469 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    NLP in language teaching

    • 676 Words
    • 3 Pages

    Richards and Rodgers wrote about method as an as an umbrella term comprising approach, design, and procedure.…

    • 676 Words
    • 3 Pages
    Good Essays
  • Good Essays

    C Program

    • 808 Words
    • 4 Pages

    A variable is said to belong to the automatic storage class if the validity or scope of the variable is limited to only the function in which it has been defined. Automatic variables are declared inside the function in which they are to be utilized. They are created when the function is called and destroyed automatically when the function is called and destroyed automatically when the function is exited, hence the name automatic. Automatic variables are therefore local to the function in which they are declared. Because of this property, automatic variables are also referred to as local or internal variable.…

    • 808 Words
    • 4 Pages
    Good Essays