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|
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
voidmethods, a method invocation or method call is an expression which has a value of a certain type. For example,
- 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
publicmethods 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.
whilestatement 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
184.108.40.206. Matching Method Vocabulary.
3.3.1 Self-Study Exercises
220.127.116.11. Constructor Definition Bug.
18.104.22.168. OneRowNim Constructors.
3.4 Retrieving Information from an Object
3.4.2 An Expanded
22.214.171.124. Determine Output.
126.96.36.199. OneRowNim get Method.
3.6 Flow of Control: Control Structures
3.6.5 The Nested if/else Multiway Selection Structure
188.8.131.52. Flow Chart.
184.108.40.206. If Debug.
3.6.6 The While Structure
While Loop Self-Study Exercises
You have attempted of activities on this page.