Added program 8 and screenshot for 8

This commit is contained in:
2026-01-29 14:49:42 +05:30
parent dde8988976
commit 6cb6664760
2 changed files with 17 additions and 0 deletions

17
GenericMethodtest.java Normal file
View File

@@ -0,0 +1,17 @@
// 8-A write a java code for generic method
public class GenericMethodtest{
public static <E> void printArray(E[] inputarray){
for(E element: inputarray){
System.out.printf("%s", element);
}
System.out.println();
}
public static void main(String args[]){
Integer[] intarray = {1, 2, 3, 4, 5};
Character[] chararray = {'a', 'b','c', 'd'};
System.out.println("array in integer");
printArray(intarray);
System.out.println("array in character");
printArray(chararray);
}
}

BIN
Screenshots/program8A.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB