I have a question on Generic List and Primitive Array (Not ArrayList) what is my question is As array & Generic List are Strong type at compile time so why do we need generics as the array will do same work as Generics.
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The generic array allows you to have a variable length array. For a normal array you have to declare it as
int[3]for example, saying there are 3 elements in it. Alist<int>does not have this limitation.Also, a list has several other methods which can come in handy, for example sorting.