25 lines
639 B
Java
25 lines
639 B
Java
class Wildcard {
|
|
|
|
static void printArray(Object[] elements) {
|
|
for (Object element : elements) {
|
|
System.out.print(element + " ");
|
|
}
|
|
System.out.println();
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
Integer[] intArray = { 1, 2, 3, 4, 5 };
|
|
String[] stringArray = { "Hello", "World" };
|
|
Double[] doubleArray = { 1.1, 2.2, 3.3 };
|
|
|
|
System.out.println("Integer Array:");
|
|
printArray(intArray);
|
|
|
|
System.out.println("String Array:");
|
|
printArray(stringArray);
|
|
|
|
System.out.println("Double Array:");
|
|
printArray(doubleArray);
|
|
}
|
|
}
|