CSC212 Lab 5 2014

From dftwiki3
Revision as of 16:12, 23 September 2014 by Thiebaut (talk | contribs) (Created page with "--~~~~ ---- =Problem 1= <br /> <source lang="java"> public class Pair<T, P> { private T first; private P second; public Pair( T f, P s ) { first = f; ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

--D. Thiebaut (talk) 16:12, 23 September 2014 (EDT)


Problem 1


public class Pair<T, P> {
    private T first;
    private P second;

    public Pair( T f, P s ) {
        first = f;
        second = s;
    }

    public T getFirst() { return first; }
    public P getSecond() { return second; }
    public void setFirst( T f ) { first = f; }
    public void setSecond( P s ) { second = s; }
    public String toString( ) { return "(" + first + ", " + second + ")"; }
}