Chapter 2: class definitions Flashcards
(17 cards)
keyword
Word like “public” and “class” that are part of the Java language. Also called reserved words
field
Variables that store persistent data within and object
Constructor
Responsible for ensuring that an object is set up properly when it is created
Method
Implements the behavior of an object
Scope
Defines the section of source code from which a variable can be accessed
lifetime
Describes how long a variable continues to exist before it is destroyed
formal parameter
parameter name inside a constructor or method
actual parameter
value of a parameter inside a constructor or method
assignment statement
Stores the value represented by the right-hand side of the statement in the variable named on the left
method header
The part of a method definition that contains the method signature
Method body
A block of code that contains the declarations and statements that define what an object does when that method is called
Block
A set of declarations and statements between a pair of matching curly brackets
Return statement
Statement that terminates execution of a method
Accessor method
Method that returns information about the state of an object
Mutator method
Method that changes the state of an object
System.out.println
Method that prints it parameter to the terminal
class header
The part of the class definition that provides the name of the class