Unit 2 vocab Flashcards

1
Q

class

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

object

A

a specific instance of a class with defined attributes. Objects are declared as variables of a class type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

constructor

A

code that is used to create new objects and initialize the object’s attributes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

new

A

keyword used to create objects with a call to one of the class’s constructors.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

instance variables

A

define the attributes for objects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

methods

A

define the behaviors or functions for objects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

dot(.) operator

A

used to access an object’s methods.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

parameters (arguments)

A

the values or data passed to an object’s method inside the parentheses in the method call to help the method do its job.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

return values

A

values returned by methods to the calling method.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

immutable

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

wrapper classes

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

new

A

is used to create a new object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

null

A

is used to indicate that an object reference doesn’t refer to any object yet.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

String(String str)

A

Constructs a new String object that represents the same sequence of characters as str.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

int length()

A

returns the number of characters in a String object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

String substring(int from, int to)

A

returns the substring beginning at index from and ending at index (to -1). The single element substring at position index can be created by calling substring(index, index + 1).

17
Q

String substring(int from)

A

returns substring(from, length()).

18
Q

int indexOf(String str)

A

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

19
Q

boolean equals(String other)

A

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

20
Q

int compareTo(String other)

A

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.

21
Q

int abs(int)

A

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

22
Q

double abs(double)

A

Returns the absolute value of a double value.

23
Q

double pow(double, double)

A

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

24
Q

double sqrt(double)

A

Returns the positive square root of a double value.

25
double random()
Returns a double value greater than or equal to 0.0 and less than 1.0 (not including 1.0!).
26
(int)(Math.random()*range) + min
moves the random number into a range starting from a minimum number. The range is the (max number - min number + 1). For example, to get a number in the range of 5 to 10, use the range 10-5+1 = 6 and the min number 5: (int)(Math.random()*6) + 5).