public class Test {
public static void main(String[] args) {
BoxRx box = new BoxRx();
Object x = "x";
box.add(x);
Object whatIsIt = box.get();
System.out.printf("whatIsIt = %s%nwhat class is it = %s%n",
whatIsIt, x.getClass().getName());
box.add(75);
whatIsIt = box.get();
System.out.println("whatIsIt = " + whatIsIt);
}
}
class BoxRx {
private Object object;
public void add(Object object) {
this.object = object;
}
public Object get() {
return object;
}
}