OOP module 6 Flashcards
A programming style in Java and other programming langauges intends to make thinking about programming closer to the real world.
Object-Oriented Programming
Objects also have _______, which are used to describe them. For example, a car can be red or blue, a mug can be full or empty, and so on. These characteristics are also called ________
Characteristics, Attributes
An attribute describes the current ____of an object.
State
The same applies to program objects, as ______ is specific to the object’s type.
Behavior
A _____ describes what an object derived from it will be, but is a completely separate entity from the object itself.
Class
Methods define _______
Behavior
A ______ is a collection of statements that are grouped together to perform an operation
Method
An example of a method is the _______________________________.
System.out.println() method.
______ a method can be done as many times as necessary.
Calling
You can also create a method that takes some data, called ________, along with it when you call it.
parameters
Parameters can be written within the method’s __________
parentheses (( ))
The method in the example takes a String called ____ as a parameter, which is used in the method’s body. Then, when calling the method, we pass the parameter’s value inside the parentheses.
Name
Methods can take multiple parameters, each separated by a ______.
comma (,).
The _____keyword can be used in methods to return a value
return
The _____ keyword can be used to allow declaration of static variables and methods that belong to the class instead of a specific instance (such as the main method):
static
A class has _______ and ______.
attributes and methods
______ is an access modifier, meaning that it is used to set the level of access:
public
_______ The class is accessible by any other class.
public
________: The class is accessible only by classes in the same package – a group of similar types of classes.
default
_________- provides the same access as the default access modifier, with the addition that subclasses can access protected methods and variables of the superclass.
protected
- accessible only within the declared class itself.
private
Used to effectively protect data, particularly when creating classes.
Getter and Setter
For each variable, the ___ method returns its value, while the ___ method sets the value
get , set
The _______________ returns the value of the attribute
getter method
The ____________ takes a parameter and assigns it to the attribute.
setter method