Skip to main content
Logo image

Java, Java, Java: Object-Oriented Problem Solving, 2022E

Section 3.12 Chapter Summary

Subsection 3.12.1 Technical Terms

accessor method loop structure repetition structure
class scope method overloading scope
formal parameter method signature selection
if statement mutator method side effect
if/else statement multiway selection while statement
inherit override while structure
local scope polymorphism

Subsection 3.12.2 Important Points

  • A formal parameter is a variable in a method declaration. It always consists of a type followed by a variable identifier. An argument is a value that is passed to a method via a formal parameter when the method is invoked. A method’s parameters constrain the type of information that can be passed to a method.
  • When an argument of primitive type is passed to a method, it cannot be modified within the method. When an argument of reference type is passed to a method, the object it refers to can be modified within the method.
  • Except for void methods, a method invocation or method call is an expression which has a value of a certain type. For example, nim.getSticks() returns a int value.
  • The signature of a method consists of its name, and the number, types, and order of its formal parameters. A class may not contain more than one method with the same signature.
  • A constructor is a method that is invoked when an object is created. If a class does not contain a constructor method, the Java compiler supplies a default constructor.
  • Restricting access to certain portions of a class is a form of information hiding. Generally, instance variables are hidden by declaring them private. The class’s public methods make up its interface.
  • The if statement executes a statement only if its boolean condition is true. The if-else statement executes one or the other of its statements depending on the value of its boolean condition. Multiway selection allows one and only one of several choices to be selected depending on the value of its boolean condition.
  • The while statement is used for coding loop structures that repeatedly execute a block of code while a boolean condition is satisfied.

Solutions 3.12.3 Solutions to Self-Study Exercises

3.2 Passing Information to an Object
3.2.8 Self-Study Exercises Matching Method Vocabulary.

3.3 Constructors
3.3.1 Self-Study Exercises Constructor Definition Bug.

3.4 Retrieving Information from an Object
3.4.2 An Expanded OneRowNimClass

Self-Study Exercises

3.6 Flow of Control: Control Structures
3.6.5 The Nested if/else Multiway Selection Structure

Self-Study Exercises

3.6.6 The While Structure

While Loop Self-Study Exercises
You have attempted of activities on this page.