AP Computer Science A - Unit 2: Using Objects

0.0(0)
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/43

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

44 Terms

1
New cards

Object

An instance of a class in Java, possessing states and behaviors.

2
New cards

Class

A blueprint or template for creating objects in Java.

3
New cards

State

Represents the characteristics or properties of an object, often stored in fields in Java.

4
New cards

Behavior

Represents the actions or functionalities of an object, often implemented as methods in Java.

5
New cards

Static Method

A method in a class that can be called directly from the class without creating an object instance.

6
New cards

Non-Static Method

A method in a class that requires an object instance to be created before it can be called.

7
New cards

Constructor

A special method used for initializing objects, often used to pass data during object creation.

8
New cards

Parameter

A type of variable in a method that allows data to be passed to the method when it is called.

9
New cards

Return Type

Specifies the type of data that a method should return after execution.

10
New cards

Method

A block of code that can be called from another part of the program, often used for code reusability and organization.

11
New cards

Primitive Type Variables

Variables that directly hold data values and are stored on the stack.

12
New cards

Stack

A memory structure where primitive type variables are stored and managed.

13
New cards

Scope

The region of code where a variable is accessible and can be referenced.

14
New cards

Lifetime of Variables

The duration for which a variable exists in memory before being destroyed.

15
New cards

Parameters

Variables in a method definition that receive values when the method is called.

16
New cards

Escape Sequences

Special sequences used to represent certain characters inside a string.

17
New cards

String Class

A class in Java used to work with text data, internally represented as an array of characters.

18
New cards

String Pool

A memory area in Java where string literals are stored to optimize memory usage.

19
New cards

.equals Method

A method in the String class used to compare the content of two strings.

20
New cards

Immutable

In the context of strings, it means that the content of a string cannot be changed once it is created.

21
New cards

String

A sequence of characters used to represent text. In Java, strings are objects that are immutable, meaning they cannot be changed once created.

22
New cards

Reference Variable

A variable that stores the memory address of an object rather than the actual value of the object itself.

23
New cards

.equals()

A method in Java used to compare the content of two strings to determine if they are equivalent.

24
New cards

.equalsIgnoreCase()

A method in Java used to compare the content of two strings while ignoring differences in capitalization.

25
New cards

.length()

A method in Java used to find the number of characters in a string.

26
New cards

.substring()

A method in Java used to extract a portion of a string based on the specified indices.

27
New cards

.compareTo()

A method in Java used to compare two strings lexicographically based on their Unicode values.

28
New cards

Math Class

A class in Java that contains various mathematical functions and constants.

29
New cards

Static Method

A method in Java that belongs to the class itself rather than to instances of the class.

30
New cards

Math.abs()

A method in the Math class used to return the absolute value of a number.

31
New cards

Math.pow()

A method in the Math class used to calculate a number raised to the power of another number.

32
New cards

Math.sqrt()

A method in the Math class used to calculate the square root of a number.

33
New cards

Math.PI

A public constant in the Math class representing the mathematical constant pi.

34
New cards

Math.random()

A method in the Math class used to generate random numbers between 0.0 (inclusive) and 1.0 (exclusive).

35
New cards

Scanner Class

A class in Java used for taking input from the user in the console.

36
New cards

new Scanner(System.in)

Initializing a Scanner object to read input from the console.

37
New cards

.nextDouble()

A method in the Scanner class used to read a double input from the console.

38
New cards

.nextInt()

A method in the Scanner class used to read an integer input from the console.

39
New cards

.nextBoolean()

A method in the Scanner class used to read a boolean input from the console.

40
New cards

.next()

A method in the Scanner class used to read the next token (word) from the input.

41
New cards

.nextLine()

A method in the Scanner class used to read the entire line of input.

42
New cards

Scanner class

A class in Java that allows the user to read input of various types from the console.

43
New cards

.next()

A method in the Scanner class that reads the next token of input as a string.

44
New cards