Error in ArrayList

When I type list = new ArrayList<>(); it shows this type of arraylist is not generic error. How do I resolve this?

Hey @code_breaker-1001, can you please share your code using the online IDE (

This is what I have written. ( For some reason my page online IDE link is showing error page not found)

	java.util.ArrayList<Integer> list = new ArrayList<>(); 		 		System.out.println(list); 		System.out.println(list.size());

Try doing this:
Add this line on outside the class
import java.util.ArrayList;

And then declare the arraylist using this line-
ArrayList<Integer> list = new ArrayList<>();

Still Showing error. It is not taking line I wrote before class. Showing error in both lines. And When I press Ctrl + Space and import ArrayList, java.util apperas on the same line as Arrayist declaration instead of outside class.

Please share your code as it’ll be easier to resolve the error then. You can use the online IDE or Github to share the code.

Sorry and Thank you Sir
Finally got my doubt resolved. Realized my mistake.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.