Methods & classes Flashcards

1
Q

What do you call an entity in your program that you can change/manipulate?

A

Object

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

What other term can you call an Object?

A

Method

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

System.out

A

Object

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

How can you manipulate the System.out object?

A

Using println method

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

Is println a method?

A

yes

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

What else do we think of an object as?

A

a black box

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

Does an object have a public interface?

A

yes

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

What is a public interface

A

methods that you call

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

What does an implementation do?

A

Uses code and data to make methods work

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

Different or similar: System.out and “Hello, World!” Why?

A

different, because they are different classes

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

What class supports a number of methods?

A

String class

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

How do you construct any object?

A
  1. use the NEW operator
  2. give the name of the CLASS
  3. supply construction PARAMETERS with parenthesis
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

variable

A

item of information in memory

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

cerealBox

A

variable

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

How do you initialize the variable Rectangle cerealBox;?

A

Use the new operator which will create an object and return its location

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

What is an object location called?

A

object reference

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

What does an access specifier do?

A

controls which other methods can call this method

18
Q

Should most methods be declared as Public?

19
Q

What statement terminates a method?

A

return ();

20
Q

What are instance fields generally declared as?

21
Q

What happens if the instance fields are declared as private?

A

all date access must run through the Public Methods

22
Q

What does an instance field belong to?

23
Q

What does the constructor always have the same as?

A

class of the objects it constructs

24
Q

What do constructors NOT have?

A

return types

25
What do constructors and methods form?
Public interface
26
What happens when the same name is used for more than one method/constructor?
Overloaded
27
What do local and parameter variables belong to?
Methods
28
What is the difference between local and instance vairables?
Initialization
29
What are instance fields initialized with if there is no constructor?
a default value
30
An object is a "black box" with a public BLANK and a hidden BLANK.
interface, implementation
31
An object stores its state in one or more variables called...
Instance fields
32
true or false: instance fields are initialized to a default value
true
33
true or false: java initializes local variables to a default value
false
34
What does it mean for a constructor or method to be overloaded?
same name but different parameters
35
What is the lifetime of a local variable?
within the method or constructor
36
System is a:
class
37
out is an:
object
38
println is a:
method
39
Public Unicorn is a :
class
40
Unicorn connect = new Unicorn(); is a :
object
41
public void getName() is a :
method
42
What is NUM_SIDES?
a constant