9B added
This commit is contained in:
20
GenericClass9B.java
Normal file
20
GenericClass9B.java
Normal file
@@ -0,0 +1,20 @@
|
||||
public class GenericClass9B<T> {
|
||||
private T t;
|
||||
|
||||
public void add(T t){
|
||||
this.t = t;
|
||||
}
|
||||
|
||||
public T get(){
|
||||
return t;
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
GenericClass9B<Integer> rhombus = new GenericClass9B<Integer>();
|
||||
GenericClass9B<Double> circle = new GenericClass9B<Double>();
|
||||
rhombus.add(33);
|
||||
circle.add(16.9);
|
||||
System.out.println(rhombus.get());
|
||||
System.out.println(circle.get());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user