The correct answer is A. Methods.
Methods are the actions that an object can perform. They are defined in the class definition and are used to manipulate the object’s attributes.
Attributes are the properties of an object. They are defined in the class definition and are used to store data about the object.
Values are the data that is stored in an attribute. They can be any type of data, such as a number, a string, or an object.
Numbers are a type of data that can be stored in an attribute. They can be integers, floating-point numbers, or complex numbers.
Here is an example of a class definition with methods and attributes:
“`class Person {
String name;
int age;
void speak() {
System.out.println(“My name is ” + name + ” and I am ” + age + ” years old.”);
}
}
“`
In this example, the Person
class has two attributes: name
and age
. It also has one method: speak()
. The speak()
method is used to print the person’s name and age.