How is the component type for the varargs array determined?

Viewed 183

When you use varargs, how is the component type of the resulting array determined?

For example, is this program guaranteed to print true or is its behaviour technically unspecified?

public static void main(String[] args) {
    foo("", 0);
}

static <T> void foo(T... arr) {
    System.out.println(arr.getClass() == Serializable[].class);
} 
4 Answers
Related