OnJava8-Examples/generics/SimpleHolder.java

14 lines
373 B
Java
Raw Normal View History

2015-04-20 15:36:01 -07:00
//: generics/SimpleHolder.java
2015-05-29 14:18:51 -07:00
// <20>2015 MindView LLC: see Copyright.txt
2015-04-20 15:36:01 -07:00
public class SimpleHolder {
private Object obj;
public void set(Object obj) { this.obj = obj; }
public Object get() { return obj; }
public static void main(String[] args) {
SimpleHolder holder = new SimpleHolder();
holder.set("Item");
String s = (String)holder.get();
}
} ///:~