This commit is contained in:
Aditya Tiwari
2026-02-05 14:06:41 +05:30
parent 1d7f4992d3
commit 2db1ec2c4d
4 changed files with 21 additions and 1 deletions

20
GenericClass9B.java Normal file
View 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());
}
}