why use generic in real life in programming code example
Example 1: why use generic in real life in programming
object[] objectArray = new string[] { "string 1", "string 2" };
Example 2: why use generic in real life in programming
public class ObjectContainer {
private Object obj;
/**
* @return the obj
*/
public Object getObj() {
return obj;
}
/**
* @param obj the obj to set
*/
public void setObj(Object obj) {
this.obj = obj;
}
}