Chapter 5 Flashcards
___ in a program can represent real-world things or abstractions
Objects
An _____ of a class is an object
instance
True or False, The class definition has no data—that is, no numbers and no string. The individual objects have the data, but the class specifies what kind of data they have. The class also specifies what actions the objects can take and how they accomplish those actions.
True
the data items and the methods are sometimes called ___ because they belong to the object
members
What are these called?
public String name;
public String breed;
public int age;
Instance Variables
Why do we need the word new ?
we use to create objects of a class.
What is nextInt is?
a method
Methods that some preform action other than returning a value are called
void methods
What is the formula to call a method?
You invoke a method by writing the name of the receiving object followed by a dot, the name of the method, and finally a set of parentheses that can contain arguments providing information for the method. Object.Method( );
What is a Scanner?
Class
True or False, Is it true that main is a void method?
true
True or False. It is preferred to use one return statement in a method.
True
Does Java have functions?
No, it doesnt
Can a void method contain a return statement?
Since a void method returns no value, it typically does not have any return statement. However, you can write a return statement within a void method without an accompanying expression, as follows:
return;
True or False, within a class definition, this is a name for the receiving object
True
What is “ this “ can be used for?
you can use the keyword this as a name for the object receiving the method call