Chapter Summary


[Page 139]

Technical Terms

accessor method

class scope

formal parameter

if statement

if-else statement

inherit

local scope

loop structure

method overloading

method signature

mutator method

multiway selection

override

polymorphism

repetition structure

scope

selection

side effect

while statement

while structure

Summary of 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 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.




Java, Java, Java(c) Object-Orienting Problem Solving
Java, Java, Java, Object-Oriented Problem Solving (3rd Edition)
ISBN: 0131474340
EAN: 2147483647
Year: 2005
Pages: 275

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net