Difference between revisions of "CSC212 Lab 5 2014"
(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; ...") |
|||
Line 21: | Line 21: | ||
</source> | </source> | ||
+ | |||
+ | # Change ints for doubles | ||
+ | # change ints for String | ||
+ | # change for String, double | ||
+ | # create array of 10 String, double | ||
+ | # create a generic class for triplet | ||
+ | # create array of 10 triplets( ) | ||
+ | # exception: | ||
+ | :# secure some pieces of code with try catch | ||
+ | :# throw |
Revision as of 15:55, 23 September 2014
--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 + ")"; }
}
- Change ints for doubles
- change ints for String
- change for String, double
- create array of 10 String, double
- create a generic class for triplet
- create array of 10 triplets( )
- exception:
- secure some pieces of code with try catch
- throw