Intended Learning Outcomes
To understand abstract type.
To enforce a design protocol by using abstract classes or interfaces .
To know the similarities and differences between an abstract class and an interface.
To become familiar with the process of program development.
To discover classes using CRC cards .
To understand the impacts of coupling to a system.
To learn the relationship types: association, aggregation, composition, realization and generalization.(UML class diagram)
To understand design principles and guidelines
Interface Syntax
Similar to a class but contains only constants and abstract methods .
Using abstract modifier.
public interface InterfaceName {
constant declarations;
method signatures;
}
public interface Stack {
public static final int MAX_SIZE = 100 ;
public abstract int pop ( ) ;
public abstract void push ( int e) ;
}
Interface class is a special class:
interfaces contain abstract methods which don’t define method bodies, you can’t create instances from an interface using the new as usual, but you can use an interface to declare a variable.