import java.io.BufferedReader;
import java.io.StringReader;
/**
* Simple generic class example
* @author gtowell
*
* @param
*/
public class GenericClass {
/** A non-generic value */
private double amount;
/** A generic value */
private A otherValue;
/**
* Constructor.
* @param other the generic value
* @param amt a double value.
*/
public GenericClass(A other, double amt) {
this.otherValue = other;
this.amount = amt;
}
/**
* Just print the values of the two instance variables
*/
public String toString() {
return "GC:" + otherValue + " " + amount;
}
public static void main(String[] args) {
GenericClass gString = new GenericClass("ASDF", 24.5);
System.out.println(gString);
GenericClass gDouble = new GenericClass(99.5, 44.5);
System.out.println(gDouble);
GenericClass gBR = new GenericClass(
new BufferedReader(new StringReader("When in the course of human events")), 99.8);
System.out.println(gBR);
}
}