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
What is an external view?
The services an object provides and its interactions
26
What is an external view in essence?
Encapsulated/abstract
27
What is interface?
How objects interact
28
How do objects behave?
Self governing and separate
29
How do object state changes occur?
By its methods
30
What is the black box?
Encapsulation/abstraction
31
How is encapsulation done?
Visibility modifiers
32
What are commonly used visibility modifiers?
Final, public, and private
33
What visibility modifiers do we not use so often?
Default and protected
34
What is bad about public variables?`
They do away with encapsulation
35
What happens when no visibility modifiers are used?
It goes into default visibility, where it can be accessed by any class in the same package
36
What is usually public and private?
Methods are public, and instance variables and support methods are private
37
What is a support method?
A method that feeds into another method because it is so complex
38
When do we mark something private?
It does not need to move outside of the class
39
What is a test class AKA as?
Driver program
40
What happens when you call a method?
It executes code and moves back to the main method
41
What is invocation?
Method calling
42
What is a method header?
The beginning of a method declaration when it is expecting input
43
What is needed in a method header?
The name and datatype of a variable
44
What part is the method?
Anything following the header that contains the code
45
What happens to local variables after code is run?
They are destroyed
46
What is important in methods?
Consistency. Like, if a method needs int num1 and int num2, we need to specify them in the test class
47
What is a precondition?
A condition that is true when a method is called
48
What is a postcondition?
A condition that is true when a method is completed
49
Where are preconditions and postconditions specified?
In comments above the method header
50
What is a constructor?
A method that initializes a newly created object; the name must match the class name
51
What does a constructor do?
Set up the instance variables, it does not return any values and is not 100% vital
52
What are accessors?
Something that is used to obtain a read-only value of something in a method
53
What is a mutator?
Something that is used to change the value of something in a method
54
What are common mutators and accessors?
getX and setX
55
How do you create a constructor?
void
56
What does a constructor do?
Set certian parameters
57
What is overloading?
Multiple methods having the same name, distinguished by their parameters
58
What is the method signature?
The number, type, and order of the parameters
59
What is necessary for overloaded methods?
Unique signatures
60
What is a static object?
One where you only need to name the class and the object
61
What is an example of an overloaded method?
Println
62
How are constructors overloaded?
They give multiple ways to initialize a new object
63
What is method decomposition?
The idea that larger methods should be broken down into several smaller parts
64
What does the substring method do?
Print stuff from a certain string location onwards
65
How is a range specified for a substring method?
(2, 7) means it would print 2, 3, 4, 5, 6 but not 7
66
What will happen if a substring method has an out of bounds range?
It will not run
67
How are objects multifarious?
They can be an output and a parameter
68
What is aggregation?
Putting stuff together, where one object references other objects
69
How do you make an array?
datatype [] name=new datatype[length]
70
How do you set values in an array?
name={value 1, value 2, value 3...ect}
71
How do you pull data from arrays?
Like the charAt function... you make a new variable and set it equal to name[location]
72
What is a multi dimensional array?
array within an array
73
How do you add arrays?
You have to process each variable individually