10. Separate classes Flashcards
Give two examples of kinds of objects which contain a group of associated variables.
ss
In what sense is an object an instance of a class? Which class?
ss
What does “this” mean (when used as an expression)? Where can we use it?
ss
What does a constructor method always do which, unlike other methods, is not stated in its heading?
ss
What is the similarity in the notion for accessing class methods of a class and instance variables of an object?
ss
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");
ss
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)));
sss
How is the declaration of a constructor method distinguishable from other methods?
ss
How do we ensure that instance variables get a value which is appropriate to the object they belong to?
ss
What are the differences between class methods and instance methods?
ss
How does an instance method know which instance variables to use for variable names without and object reference and a dot before them?
ss
In what sort of circumstances are we likely to want a method that has no parameters?
ss
What is the name of the instance method that allows us to have control of this conversion?
ss
Which types, if any, are both primitive and reference? What about String?
ss
What are the differences between a class variable and an instance variable and how do we state which is which?
ss