CS Awesome - Unit 2 Vocabulary

studied byStudied by 1 person
0.0(0)
Get a hint
Hint

class

1 / 36

flashcard set

Earn XP

Description and Tags

AP Computer Science Unit 2 - Using Objects

37 Terms

1

class

defines a new data type (a classification). It is the formal implementation, or blueprint, of the attributes and behaviors of the objects of that class

New cards
2

object

a specific instance of a class with defined attributes.

New cards
3

attributes

data the object knows about itself

New cards
4

instance variables

variables in a class that define the attributes for objects

New cards
5

methods

these define the behaviors or functions for objects to describe what objects can do

New cards
6

constructor

creates a new object and initializes its attributes (they have the same name as the class).

New cards
7

new

used to create a new object; every object is created uterm-3sing the keyword new followed by a call to one of the class's constructors that initializes the object's attributes

New cards
8

constructor signature or header

the constructor name followed by the parameter list

New cards
9

method signature or header

the method name followed by the parameter list

New cards
10

wrapper classes

classes that create objects from primitive types, for example the Integer class and Double class

New cards
11

null

used to indicate that an object reference doesn't refer to any object yet

New cards
12

Math method: int abs(int)

Returns the absolute value of an int value (which means no negatives).

New cards
13

Math method: double abs(double)

Returns the absolute value of a double value.

New cards
14

Math method: double pow(double, double)

Returns the value of the first parameter raised to the power of the second parameter.

New cards
15

Math method: double sqrt(double)

Returns the positive square root of a double value.

New cards
16

Math.random()

Returns a random double value greater than or equal to 0.0 and less than 1.0 (not including 1.0)!

New cards
17

parameter list

a list of the types and variable names for the arguments being passed to a method or constructor.

New cards
18

overloading

creating multiple methods or constructors with the same name but different number or types of parameters.

New cards
19

call by value

When you call a method or constructor and give it an argument, a copy of the argument's value is saved in the parameter variable.

New cards
20

NullPointerException

This is the error if you try to call an object method on an object variable whose value is null

New cards
21

non-static or object method

These methods must be called using an object name . method name.

New cards
22

static method

These methods belong to a class and can be called by using the class name instead of creating an object.

New cards
23

return value

The value returned from a method to the calling method

New cards
24

strings

objects of the String class that hold sequences of characters.

New cards
25

index

a number associated with a position in a string (or array)

New cards
26

immutable

String methods do not change the String object. Any method that seems to change a string actually creates a new string.

New cards
27

substring

part of a string (the method will create a new string that contains a copy of part of the original string).

New cards
28

String method: int length()

returns the number of characters in a String object.

New cards
29

String substring(int from, int to)

returns the substring beginning at index from and ending at index (to - 1).

New cards
30

String substring(int from)

returns substring(from, length()).

New cards
31

int indexOf(String str)

returns the index of the first occurrence of str; returns -1 if not found.

New cards
32

boolean equals(String other)

returns true if this (the calling object) is equal to other; returns false otherwise.

New cards
33

int compareTo(String other)

returns a value < 0 if this is less than other; returns zero if this is equal to other; returns a value > 0 if this is greater than other.

New cards
34

substring(index, index + 1)

returns a single character at position index

New cards
35

autoboxing

the automatic conversion of primitive types to their corresponding object wrapper classes, for example int to Integer.

New cards
36

unboxing

the automatic conversion of wrapper class to the primitive type, for example Integer to int.

New cards
37

(int)(Math.random()*range) + min

moves the random number into a range starting from a minimum number where the range is the (max number - min number + 1)

New cards

Explore top notes

note Note
studied byStudied by 132 people
... ago
5.0(1)
note Note
studied byStudied by 55 people
... ago
4.5(2)
note Note
studied byStudied by 7 people
... ago
5.0(1)
note Note
studied byStudied by 30 people
... ago
5.0(1)
note Note
studied byStudied by 37 people
... ago
5.0(1)
note Note
studied byStudied by 6 people
... ago
5.0(1)
note Note
studied byStudied by 16 people
... ago
5.0(1)
note Note
studied byStudied by 23129 people
... ago
4.8(187)

Explore top flashcards

flashcards Flashcard (21)
studied byStudied by 4 people
... ago
5.0(1)
flashcards Flashcard (93)
studied byStudied by 13 people
... ago
5.0(2)
flashcards Flashcard (27)
studied byStudied by 5 people
... ago
5.0(1)
flashcards Flashcard (58)
studied byStudied by 4 people
... ago
5.0(1)
flashcards Flashcard (83)
studied byStudied by 8 people
... ago
5.0(1)
flashcards Flashcard (30)
studied byStudied by 1 person
... ago
5.0(1)
flashcards Flashcard (22)
studied byStudied by 2 people
... ago
5.0(1)
flashcards Flashcard (68)
studied byStudied by 29 people
... ago
5.0(2)
robot