We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Java
- Data Structures
- Java Generics
- Discussions
Java Generics
Java Generics
Sort by
recency
|
274 Discussions
|
Please Login in order to post a comment
public static void main(String[] args) { Object[] arr = {1, 2, 3, "Hello", "World"}; printArray(arr); } static void printArray(T[] array){ for(T element: array){ System.out.println(element); } }
static void printArray(T[] arr){
import java.io.IOException; import java.lang.reflect.Method;
class Printer { public static void printArray(T array[]){ for(T temp : array) { System.out.println(temp); } } }
public class Solution {
}
//This is my solution, use in case to need