10. Separate classes Flashcards

1
Q

Give two examples of kinds of objects which contain a group of associated variables.

A

ss

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

In what sense is an object an instance of a class? Which class?

A

ss

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

What does “this” mean (when used as an expression)? Where can we use it?

A

ss

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

What does a constructor method always do which, unlike other methods, is not stated in its heading?

A

ss

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

What is the similarity in the notion for accessing class methods of a class and instance variables of an object?

A

ss

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

Assuming the Point example from the chapter 10, is the following code legal, and if so, what will be the output?

if (new Point(10, 20).equals(new Point(10, 20)))
  System.out.println("The two points are equivalent");
else
  System.out.println("The two points are not equivalent");
A

ss

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

Assuming the Point example from the chapter 10, is the following code legal, and if so, what will be the output?

System.out.println(new Point(10, 10).halfWayPoint(new Point(20, 20)));

A

sss

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

How is the declaration of a constructor method distinguishable from other methods?

A

ss

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

How do we ensure that instance variables get a value which is appropriate to the object they belong to?

A

ss

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

What are the differences between class methods and instance methods?

A

ss

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

How does an instance method know which instance variables to use for variable names without and object reference and a dot before them?

A

ss

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

In what sort of circumstances are we likely to want a method that has no parameters?

A

ss

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

What is the name of the instance method that allows us to have control of this conversion?

A

ss

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

Which types, if any, are both primitive and reference? What about String?

A

ss

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

What are the differences between a class variable and an instance variable and how do we state which is which?

A

ss

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

What do we gain by making our instance variables private?

A

ss

17
Q

How do we declare a variable of type Date?

A

ss

18
Q

What possible values can a variable of type Date hold?

A

ss

19
Q

What are the two common mistakes regarding variables, objects and references?

A

ss