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?

A

Yes

19
Q

What statement terminates a method?

A

return ();

20
Q

What are instance fields generally declared as?

A

private

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?

A

A class

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
Q

What do constructors and methods form?

A

Public interface

26
Q

What happens when the same name is used for more than one method/constructor?

A

Overloaded

27
Q

What do local and parameter variables belong to?

A

Methods

28
Q

What is the difference between local and instance vairables?

A

Initialization

29
Q

What are instance fields initialized with if there is no constructor?

A

a default value

30
Q

An object is a “black box” with a public BLANK and a hidden BLANK.

A

interface, implementation

31
Q

An object stores its state in one or more variables called…

A

Instance fields

32
Q

true or false: instance fields are initialized to a default value

A

true

33
Q

true or false: java initializes local variables to a default value

A

false

34
Q

What does it mean for a constructor or method to be overloaded?

A

same name but different parameters

35
Q

What is the lifetime of a local variable?

A

within the method or constructor

36
Q

System is a:

A

class

37
Q

out is an:

A

object

38
Q

println is a:

A

method

39
Q

Public Unicorn is a :

A

class

40
Q

Unicorn connect = new Unicorn(); is a :

A

object

41
Q

public void getName() is a :

A

method

42
Q

What is NUM_SIDES?

A

a constant