zuai-logo
zuai-logo
  1. AP Computer Science A
FlashcardFlashcardStudy GuideStudy GuideQuestion BankQuestion BankGlossaryGlossary

Glossary

A

Access modifier

Criticality: 2

A keyword that sets the accessibility level for classes, variables, methods, and constructors.

Example:

The *public* keyword in public static int add(int a, int b) means this method can be accessed from any other class.

B

Boolean method

Criticality: 3

A non-void method that evaluates a condition and returns either `true` or `false`.

Example:

The *isLoggedIn*() method might return true if a user is authenticated, or false otherwise.

M

Method name

Criticality: 1

The identifier used to call or invoke a specific method.

Example:

In public String *getStudentName*(), getStudentName is the method's identifier.

Mismatched return types

Criticality: 3

A compile-time error that occurs when the type of the value returned by a method does not match the return type declared in the method's header.

Example:

Declaring public int getAverage() but then trying to *return* 15.5; would cause a mismatched return type error.

N

Non-void method

Criticality: 3

A method that calculates or retrieves a value and then returns it for use elsewhere in the program.

Example:

The calculateArea(double length, double width) method returns a double representing the area, allowing you to use that calculated value in other parts of your program, like System.out.println("Area: " + shapes.*calculateArea*(10, 5));.

P

Parameter list

Criticality: 2

A comma-separated list of input variables (parameters) that a method accepts to perform its task.

Example:

In public int sum(int num1, int num2), *int num1, int num2* is the parameter list, specifying the two integer inputs the method needs.

R

Reference type

Criticality: 2

A data type that refers to an object, rather than holding the value directly, such as `String` or `ArrayList`.

Example:

A method returning an *ArrayList*<String> provides a reference to a list of strings, not the list's contents directly.

Return type (dataType)

Criticality: 3

The type of value that a non-void method is declared to return, which must match the type of the value actually returned by the method.

Example:

In public double calculatePrice(int quantity), *double* is the return type, meaning the method will send back a decimal number.

S

String method

Criticality: 2

A non-void method that performs operations on or generates `String` objects and returns a `String` result.

Example:

The *formatName*(String firstName, String lastName) method could return a combined String like "Doe, John".

U

Unreachable code

Criticality: 2

Any code within a method that appears after a `return` statement, and therefore will never be executed.

Example:

In a method, return result; followed by System.out.println("Done"); makes the *System.out.println* line unreachable.

r

return statement

Criticality: 3

A statement used in a non-void method to terminate its execution and send a specified value back to the caller.

Example:

After calculating a sum, *return* total; sends the total value back to where the method was called.

s

static keyword

Criticality: 2

A keyword indicating that a method or variable belongs to the class itself, rather than to any specific object instance of that class.

Example:

The Math.random() method is *static* because you call it directly on the Math class, not on an object like new Math().random().