M3 Flashcards
Is a blueprint for the object. Before we create an object, we first need to define the class.
Class
Is called an instance of a class.
Object
Is a blueprint or template for
creating objects. It defines the properties (attributes) and behaviors (methods) that the
objects created from the class will have.
Class
Is an instance of a class. It represents a real-world entity that has attributes (data) and behaviors (methods). Before using an object, we must define a class first.
Object
(Also known as fields or properties) are the characteristics or data that an object holds.
• They represent the state or information about an object.
Attributes
Are functions or procedures defined within a class that describe the behavior of the object.
Can perform actions, modify attributes, or return a result.
Methods
We can create our own method based on our requirements
User Defines Methods
These are built-in methods in Java that are available to use.
Standard Library Methods
It specifies what type of value a method returns. For example if a method has an int return type then it returns an integer value.
returnType
It is an identifier that is used to refer to the particular method in a program.
methodName
It includes the programming statements that are used to perform some tasks. The method body is enclosed inside the curly braces { }.
Method body
It defines access types whether the method is public, private,and so on.
Modifier
If we use the static keyword, it
can be accessed without creating
objects.
Static
These are values passed to a method. We can pass any number of arguments to a method.
parameter1/parameter2
is a value accepted by the method. As mentioned earlier, a method can also have any number of parameters.
Method parameter
Are used to get the value of a private field
Accessors/Getters
Are used to set the value of a private field.
Mutators/Setters
Commonly known as a get
method or simply a getter. A
property of the object is
returned by the accessor
method. They are declared as
public.
Accessor Method
Commonly known as a set
method or simply a setter. A
Mutator method mutates
things, in other words change
things. They are also known as
modifiers.
Mutator Method
Is a special method that is used to
initialize objects. It is used to
initialize the attributes of an
object or run a block of code
Constructor