Methods & classes Flashcards
What do you call an entity in your program that you can change/manipulate?
Object
What other term can you call an Object?
Method
System.out
Object
How can you manipulate the System.out object?
Using println method
Is println a method?
yes
What else do we think of an object as?
a black box
Does an object have a public interface?
yes
What is a public interface
methods that you call
What does an implementation do?
Uses code and data to make methods work
Different or similar: System.out and “Hello, World!” Why?
different, because they are different classes
What class supports a number of methods?
String class
How do you construct any object?
- use the NEW operator
- give the name of the CLASS
- supply construction PARAMETERS with parenthesis
variable
item of information in memory
cerealBox
variable
How do you initialize the variable Rectangle cerealBox;?
Use the new operator which will create an object and return its location
What is an object location called?
object reference
What does an access specifier do?
controls which other methods can call this method
Should most methods be declared as Public?
Yes
What statement terminates a method?
return ();
What are instance fields generally declared as?
private
What happens if the instance fields are declared as private?
all date access must run through the Public Methods
What does an instance field belong to?
A class
What does the constructor always have the same as?
class of the objects it constructs
What do constructors NOT have?
return types