What is the result of the following code execution?

import java.util.Arrays;

class Generic<T extends Number> { 
    private T arr[] = {1, 2, 3, 4, 5};
 
    public String toString(){ 
        return Arrays.toString(arr);
    } 
} 

public class Test { 
    public static void main(String [] args) { 
        Generic<Double> obj = new Generic<Double>();
        System.out.println(obj); 
    } 
}
Explanation
Compilation error during an array declaration.
Initialization lists cannot be used to initialize parameterized arrays.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback