Ch. 4 Flashcards

1
Q

What does it mean when something returns a value?

A

It’s doing some kind of calculation

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

What does it mean when something does not return a value?

A

It’s printing a statement, not much math

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

When something is in parentheses before the method, what does it mean?

A

It’s being inputted

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

What is an instance variable?

A

Variables associated with a class we write, like characteristics

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

What is a class like?

A

A template to create objects

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

What is encapsulation?

A

Keeping data at a level that is appropriate for that sort of data

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

What is a private variable?

A

A variable that will not be seen outside of the class.

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

What is method declaration?

A

Making a method to do something

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

What is method invocation?

A

Using a method

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

What is paramater passing?

A

Inputting something into a method then passing it along to something else

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

What is method overloading?

A

When you use different versions of the same methods that allow for multiple parameters

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

What is object state?

A

Descriptive characteristics that would call for using an instance variable

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

What is an object behavior?

A

What an object can do or what you can do with it

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

What does a class contain?

A

Data and method declarations

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

What is a data declaration?

A

A form of instance variable

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

What is scope?

A

Where data can be seen and used

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

What is local data?

A

Data declared in a method that can only be used in that method

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

What is a package?

A

A collection of code put together, like a higher level piece that catches a bunch of projects at once

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

Where can data declaredat the class level be used?

A

All methods in the class

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

Where can data declared in a method be used?

A

That method only

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

What level is the class level?

A

The top layer

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

What is instance data?

A

A value assigned to an instance variable specific to each class

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

What do objects of a method share?

A

Method definitions but not data space

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

What is an internal view?

A

Objects hold variables and methods that make it useful

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

What is an external view?

A

The services an object provides and its interactions

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

What is an external view in essence?

A

Encapsulated/abstract

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

What is interface?

A

How objects interact

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

How do objects behave?

A

Self governing and separate

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

How do object state changes occur?

A

By its methods

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

What is the black box?

A

Encapsulation/abstraction

31
Q

How is encapsulation done?

A

Visibility modifiers

32
Q

What are commonly used visibility modifiers?

A

Final, public, and private

33
Q

What visibility modifiers do we not use so often?

A

Default and protected

34
Q

What is bad about public variables?`

A

They do away with encapsulation

35
Q

What happens when no visibility modifiers are used?

A

It goes into default visibility, where it can be accessed by any class in the same package

36
Q

What is usually public and private?

A

Methods are public, and instance variables and support methods are private

37
Q

What is a support method?

A

A method that feeds into another method because it is so complex

38
Q

When do we mark something private?

A

It does not need to move outside of the class

39
Q

What is a test class AKA as?

A

Driver program

40
Q

What happens when you call a method?

A

It executes code and moves back to the main method

41
Q

What is invocation?

A

Method calling

42
Q

What is a method header?

A

The beginning of a method declaration when it is expecting input

43
Q

What is needed in a method header?

A

The name and datatype of a variable

44
Q

What part is the method?

A

Anything following the header that contains the code

45
Q

What happens to local variables after code is run?

A

They are destroyed

46
Q

What is important in methods?

A

Consistency. Like, if a method needs int num1 and int num2, we need to specify them in the test class

47
Q

What is a precondition?

A

A condition that is true when a method is called

48
Q

What is a postcondition?

A

A condition that is true when a method is completed

49
Q

Where are preconditions and postconditions specified?

A

In comments above the method header

50
Q

What is a constructor?

A

A method that initializes a newly created object; the name must match the class name

51
Q

What does a constructor do?

A

Set up the instance variables, it does not return any values and is not 100% vital

52
Q

What are accessors?

A

Something that is used to obtain a read-only value of something in a method

53
Q

What is a mutator?

A

Something that is used to change the value of something in a method

54
Q

What are common mutators and accessors?

A

getX and setX

55
Q

How do you create a constructor?

A

void

56
Q

What does a constructor do?

A

Set certian parameters

57
Q

What is overloading?

A

Multiple methods having the same name, distinguished by their parameters

58
Q

What is the method signature?

A

The number, type, and order of the parameters

59
Q

What is necessary for overloaded methods?

A

Unique signatures

60
Q

What is a static object?

A

One where you only need to name the class and the object

61
Q

What is an example of an overloaded method?

A

Println

62
Q

How are constructors overloaded?

A

They give multiple ways to initialize a new object

63
Q

What is method decomposition?

A

The idea that larger methods should be broken down into several smaller parts

64
Q

What does the substring method do?

A

Print stuff from a certain string location onwards

65
Q

How is a range specified for a substring method?

A

(2, 7) means it would print 2, 3, 4, 5, 6 but not 7

66
Q

What will happen if a substring method has an out of bounds range?

A

It will not run

67
Q

How are objects multifarious?

A

They can be an output and a parameter

68
Q

What is aggregation?

A

Putting stuff together, where one object references other objects

69
Q

How do you make an array?

A

datatype [] name=new datatype[length]

70
Q

How do you set values in an array?

A

name={value 1, value 2, value 3…ect}

71
Q

How do you pull data from arrays?

A

Like the charAt function… you make a new variable and set it equal to name[location]

72
Q

What is a multi dimensional array?

A

array within an array

73
Q

How do you add arrays?

A

You have to process each variable individually