public static void main(String args[])
{
int[] intarray = {1, 3, 6, 8, 2, 6};
String[] names = {"String1", "String2", "String3", "String4", "String5", "String6"};
printMe(intarray);
}
public static <T> void printMe(T[] i){
for(T x: i)
{
System.out.println(x);
}
}
Why does compiling this code result in this error?
The method printMe(T[]) is not applicable for the arguments (int[])
If I do printMe(names)
then it works.