Upload files to "OOP/Java/Lab/Week12"
This commit is contained in:
parent
2ae5d58f75
commit
100e80ccc3
5 changed files with 226 additions and 0 deletions
24
OOP/Java/Lab/Week12/WildCard.java
Normal file
24
OOP/Java/Lab/Week12/WildCard.java
Normal file
|
@ -0,0 +1,24 @@
|
|||
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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue