Next:
Summary
Up:
All Units
Unit 3
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
Use of a defined class
Controlling the access to the fields of a class
Rules for accessing the fields of a class
Instance variables
Scope of instance variables
Lifetime of instance variables
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
Inheritance
Inheritance: example
Fundamental features of derived classes
Constructor of a derived class
Use of
super
Inherited methods and variables
Compatibility
Compatibility between actual and formal parameters
Access to the public and private fields of the superclass
Overriding of methods
Overriding of methods: example
Polymorphism
Class hierarchy
The class
Object
Use of
toString
in
print
and
println
Composition (optional)
Inheritance or composition? (optional)
Exercises
Next:
Summary
Up:
All Units