| 4 | // Visit http://OnJava8.com for more book information. |
| 5 | |
| 6 | public class ObjectHolder { |
| 7 | private Object a; |
| 8 | public ObjectHolder(Object a) { this.a = a; } |
| 9 | public void set(Object a) { this.a = a; } |
| 10 | public Object get() { return a; } |
| 11 | public static void main(String[] args) { |
| 12 | ObjectHolder h2 = |
| 13 | new ObjectHolder(new Automobile()); |
| 14 | Automobile a = (Automobile)h2.get(); |
| 15 | h2.set("Not an Automobile"); |
| 16 | String s = (String)h2.get(); |
| 17 | h2.set(1); // Autoboxes to Integer |
| 18 | Integer x = (Integer)h2.get(); |
| 19 | } |
| 20 | } |
nothing calls this directly
no outgoing calls
no test coverage detected