generic interfaces in java code example
Example 1: i need a generic class which extends User class which implement an interface
public class SomeClass<T extends Fragment & SomeInterface>
Example 2: generics Interface in java
package com.journaldev.generics;
public class GenericsTypeOld {
private Object t;
public Object get() {
return t;
}
public void set(Object t) {
this.t = t;
}
public static void main(String args[]){
GenericsTypeOld type = new GenericsTypeOld();
type.set("Pankaj");
String str = (String) type.get();
}
}