AP Computer Science A - Unit 2: Using Objects

studied byStudied by 12 people
0.0(0)
Get a hint
Hint

Object

1 / 43

44 Terms

1

Object

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

New cards
2

Class

A blueprint or template for creating objects in Java.

New cards
3

State

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

New cards
4

Behavior

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

New cards
5

Static Method

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

New cards
6

Non-Static Method

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

New cards
7

Constructor

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

New cards
8

Parameter

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

New cards
9

Return Type

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

New cards
10

Method

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

New cards
11

Primitive Type Variables

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

New cards
12

Stack

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

New cards
13

Scope

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

New cards
14

Lifetime of Variables

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

New cards
15

Parameters

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

New cards
16

Escape Sequences

Special sequences used to represent certain characters inside a string.

New cards
17

String Class

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

New cards
18

String Pool

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

New cards
19

.equals Method

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

New cards
20

Immutable

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

New cards
21

String

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

New cards
22

Reference Variable

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

New cards
23

.equals()

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

New cards
24

.equalsIgnoreCase()

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

New cards
25

.length()

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

New cards
26

.substring()

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

New cards
27

.compareTo()

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

New cards
28

Math Class

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

New cards
29

Static Method

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

New cards
30

Math.abs()

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

New cards
31

Math.pow()

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

New cards
32

Math.sqrt()

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

New cards
33

Math.PI

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

New cards
34

Math.random()

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

New cards
35

Scanner Class

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

New cards
36

new Scanner(System.in)

Initializing a Scanner object to read input from the console.

New cards
37

.nextDouble()

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

New cards
38

.nextInt()

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

New cards
39

.nextBoolean()

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

New cards
40

.next()

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

New cards
41

.nextLine()

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

New cards
42

Scanner class

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

New cards
43

.next()

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

New cards
44
New cards

Explore top notes

note Note
studied byStudied by 4 people
... ago
5.0(1)
note Note
studied byStudied by 21 people
... ago
5.0(1)
note Note
studied byStudied by 21 people
... ago
5.0(1)
note Note
studied byStudied by 1 person
... ago
5.0(1)
note Note
studied byStudied by 6 people
... ago
5.0(1)
note Note
studied byStudied by 31 people
... ago
5.0(1)
note Note
studied byStudied by 6 people
... ago
5.0(1)
note Note
studied byStudied by 674 people
... ago
5.0(4)

Explore top flashcards

flashcards Flashcard (63)
studied byStudied by 22 people
... ago
5.0(1)
flashcards Flashcard (85)
studied byStudied by 14 people
... ago
5.0(1)
flashcards Flashcard (183)
studied byStudied by 7 people
... ago
5.0(1)
flashcards Flashcard (20)
studied byStudied by 1 person
... ago
5.0(1)
flashcards Flashcard (34)
studied byStudied by 21 people
... ago
5.0(1)
flashcards Flashcard (58)
studied byStudied by 17 people
... ago
5.0(1)
flashcards Flashcard (58)
studied byStudied by 12 people
... ago
5.0(2)
flashcards Flashcard (76)
studied byStudied by 452 people
... ago
5.0(7)
robot