OOP 2, Classes and Objects
Patrick Doherty
Ida/Lith
OOP 2, Classes and Objects
III. Inheritance Revisited
Abstract Classes
Abstract Class Example
Abstract Class Subclasses
Using the Abstract Class
Abstract Classes: Miscellaneous
Final Classes
Summary: Class Modifers
Interfaces
Interfaces
A System Example
A User Example
Using an Interface
Extending an Interface
Interfaces and Name Conflicts
Interfaces and Forwarding.
Interfaces and Callback
A Timer Class with Caller
Interfaces and Abstract Classes
II. Encapsulation Revisited
Packages
Java API (1.1)
Some Core API Packages
The Package java.lang
User Packages
Name Conflict Problems
How the Compiler Works
A Java Compilation Unit
Automatic Compilation
Relating Package Names to Dirs.
CLASSPATH-Package-Class
How the Compiler Searches
A Common Error
Avoiding Clashes on the Internet
Data Hiding in Java
Class Visibility
Class Visibility Example
Variable Visibility
Private Variables
A Java Class with Total Visibility
The Java Class with Hidden Data
Changing the Data Representation
Java Access Modifiers
Access Table
Public - Visible Everywhere
Protected - Visible in Package + any subclasses
Default - Visible in Package Only
Private Protected - Visible in Subclasses Everywhere
Private - Visible only in class
Hiding Methods
Interesting Private Example
Interesting Protected Example
Other Data Field Modifiers
Other Method Field Modifers