Advanced OOP Concepts in Java
Advanced OOP Concepts in Java
Michael B. Spring
Department of Information Science and Telecommunications
University of Pittsburgh
[email protected]
http://www.sis.pitt.edu/~spring
09/28/2001 1
Overview of Part 1 of the Course
• Demystifying Java: Simple Code
• Introduction to Java
• An Example of OOP in practice
• Object Oriented Programming Concepts
• OOP Concepts -- Advanced This slide set
• Hints and for Java
• I/O (Streams) in Java
• Graphical User Interface Coding in Java
• Exceptions and Exception handling
}
Anonymous Class
Some style guidelines for using anonymous class:
• The class has a very short body.
• Only one instance of the class is needed at a time.
• The class is used immediately after it is defined.
• A name for the class does not make the code easier to
understand.
Since an anonymous class has no name, it is not possible to
define a constructor. Java 1.1 has a new feature –
instance initializer – to conveniently initialize the
object created for an anonymous class. But the feature
applies to all classes.