Will the following code compile?

public class GenericTest {
    public static void main(String[] args) {        
        List<double> myList = new ArrayList<double>(); 
    }
}
Explanation
Generic classes cannot be parameterised by primitive types.
Standard collections in Java allow to store only objects.
docs.oracle.com/javase/..../collection.html

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback