program 9

This commit is contained in:
2026-02-05 13:57:58 +05:30
parent 19f60776c9
commit 8b07a727b4
2 changed files with 12 additions and 0 deletions

12
GenericClass.java Normal file
View File

@@ -0,0 +1,12 @@
// write a java code for generic class
public class GenericClass<T1, T2>{
public void display(T1 var1, T2 var2){
System.out.println("Name: " + var1 + ", ID:" + var2);
}
public static void main(String[] args){
GenericClass<String,Integer> obj1 = new GenericClass<String,Integer>();
GenericClass<Integer,Integer> obj2 = new GenericClass<Integer,Integer>();
obj1.display("abc", 101);
obj2.display(201, 301);
}
}

BIN
Screenshots/program9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB