Glossary

@

@Override Annotation

Criticality: 2

An annotation used to indicate that a method in a subclass is intended to override a method in its superclass. It helps catch errors if the method signature doesn't match.

Example:

The @Override annotation above the toString() method in Assignment indicates that this method is providing its own implementation of a method inherited from a parent class.

A

Access Modifier

Criticality: 3

Keywords in Java that set the accessibility level for classes, variables, methods, and constructors. They control where a member can be accessed from.

Example:

Using private as an access modifier for correctAnswer in the Assignment class means it can only be accessed within that class.

C

Constructor

Criticality: 3

A special type of method used to initialize new objects of a class. It has the same name as the class and no return type.

Example:

public Student(int gradeLev, String fullName, int ageNum) is a constructor used to create and set up a new Student object.

G

Getter Method

Criticality: 3

A method that provides read-only access to an instance variable, typically returning its value. They are also known as accessor methods.

Example:

public int getGradeLevel() is a getter method that allows other parts of the program to retrieve the student's grade level without directly accessing the private variable.

I

Instance Variable

Criticality: 3

A variable declared within a class but outside any method, constructor, or block. Each object (instance) of the class has its own copy of these variables.

Example:

In the Student class, name and gradeLevel are instance variables because each student object will have its own unique name and grade level.

J

Javadoc Comments

Criticality: 1

Special multi-line comments in Java that begin with `/**` and end with `*/`. They are used to document code and can be processed by the Javadoc tool to generate API documentation.

Example:

The comment /** Represents an assignment that a student will complete */ above the Assignment class is a Javadoc comment, explaining its purpose.

M

Method Header

Criticality: 3

The first line of a method declaration, specifying its access modifier, return type, name, and parameters. It defines the method's signature.

Example:

public boolean gradeAssignment(boolean studentAnswer) is a method header that tells us the method is public, returns a boolean, is named gradeAssignment, and takes a boolean parameter.

Method Name

Criticality: 3

The identifier given to a method, used to call or invoke it. It should be descriptive of the method's purpose.

Example:

gradeAssignment is the method name for the function that checks if a student's answer is correct.

Mutable Object (as parameter)

Criticality: 2

An object whose state (its instance variables) can be changed after it is created. When a mutable object is passed as a parameter, changes to its internal state *will* affect the original object outside the method.

Example:

If a Student object (which is mutable) is passed to a method and that method calls student.setName("New Name"), the original Student object's name will be updated.

P

Parameters

Criticality: 3

Variables declared in the method header that receive values (arguments) passed into the method when it is called. They allow methods to operate on specific data.

Example:

In public boolean gradeAssignment(boolean studentAnswer), studentAnswer is a parameter that holds the student's submitted answer.

Pass-by-value

Criticality: 3

A mechanism where a copy of the actual argument's value is passed to the method parameter. For primitive types, changes to the parameter inside the method do not affect the original variable outside.

Example:

When you call calculateSum(int num), num receives a copy of the value, so if num is changed within calculateSum, the original variable remains unaffected.

R

Reference Variable

Criticality: 3

A variable that stores the memory address of an object, rather than the object's actual data. When a reference variable is passed to a method, a copy of this memory address is passed.

Example:

In Student myStudent = new Student(...), myStudent is a reference variable pointing to the Student object in memory.

Return Type

Criticality: 3

The data type of the value that a method sends back to the caller after its execution. If a method does not return any value, its return type is `void`.

Example:

In public int getGradeLevel(), int is the return type, indicating the method will send back an integer value.

S

Setter Method

Criticality: 3

A method that allows modification of an instance variable, typically taking a parameter to update the variable's value. They are also known as mutator methods.

Example:

public void setName(String fullName) is a setter method that allows the student's name to be changed from outside the class.

p

private (Access Modifier)

Criticality: 3

An access modifier that restricts access to a class, method, or variable only within the class where it is declared. It promotes encapsulation.

Example:

The name variable in the Student class is private, meaning it can only be directly accessed or modified by methods within the Student class itself.

protected (Access Modifier)

Criticality: 2

An access modifier that allows access to a member within its own class, classes in the same package, and subclasses (even if in different packages).

Example:

A protected method in a base class might be designed for use by its derived classes, but not by unrelated classes.

public (Access Modifier)

Criticality: 3

An access modifier that makes a class, method, or variable accessible from any other class. It provides the widest scope.

Example:

A public method like getGradeLevel() can be called by any other part of the program to retrieve a student's grade.

t

toString() Method

Criticality: 2

A method inherited from the `Object` class that provides a string representation of an object. It is often overridden to provide a meaningful description.

Example:

Calling System.out.println(myStudent) implicitly invokes the toString() method of the myStudent object to print its details.

v

void (Return Type)

Criticality: 3

A keyword used as a return type for methods that do not return any value. These methods perform actions but don't produce a result to be used by the caller.

Example:

The setName(String fullName) method has a void return type because its purpose is to change the student's name, not to provide a value back.