Next:
Summary
Up:
All Units
Unit 03
Definitions of methods and classes
Summary
Modularization
Abstraction
Abstraction on operations: methods
Methods seen as modules
Definition of static methods
Examples of definitions of static methods
Result of a method: the
return
statement
Example: use of static methods defined in the same class
Example: use of static methods defined in another class
Parameter passing
Execution of a method
Example: modification of an object done by a method
Local variables
Scope of local variables
Example: scope of local variables
Lifetime of local variables
Overloading of methods
Abstraction on objects
Classes seen as modules
Definition of a class
Example of a class definition
Instance variables
Use of a defined class
Controlling the access to the fields of a class
Scope of instance variables
Lifetime of instance variables
Rules for accessing the fields of a class
Definition of methods
The implicit formal parameter
this
Use of
this
Constructors
Invocation of a constructor
Overloading of constructors
Standard constructor
Design methodology for a class: realization of a class
Design methodology for a class: clients of the class
Example for the design of a class
Example for the design of a class: representation for the objects
Example for the design of a class: public interface
Example for the design of a class: realization of the methods
Example for the design of a class: a client
The
toString()
method
Use of
toString()
in
print()
and
println()
Exercises
Next:
Summary
Up:
All Units