Java- javadoc examples

//1. save the file with container.java
//2.compile it using javadoc container.java

/**
* A Container is an object that contains other objects.
* @author Trevor Miller
* @version 1.2
* @since 0.3
*/
public abstract class Container {
   
/**
* Create an empty container.
*/
protected Container() { }
   
/**
* Return the number of elements contained in this container.
* @return The number of objects contained
*/
public abstract int count();
   
/**
* Clear all elements from this container.
* This removes all contained objects.
*/
public abstract void clear();
   
/**
* Accept the given visitor to visit all objects contained.
* @param visitor The visitor to accept
*/
public abstract void accept(final Visitor visitor);
   
/**
* Return an iterator over all objects conatined.
* @return An iterator over all objects
*/
public abstract Iterator iterator();
   
/**
* Determine whether this container is empty or not.
* @return <CODE>true</CODE> if the container is empty:
* <CODE>count == 0</CODE>, <CODE>false</CODE>
* otherwise
*/
public boolean isEmpty() {
    return (this.count() == 0);
}
   
/**
* Determine whether this container is full.
* @return <CODE>true</CODE> if conatiner is full,
* <CODE>false</CODE> otherwise
*/
public boolean isFull() {
    return false;
}
   

}

Reactions: