I was solving a problem before including it in my code and using List to get strings then work around with them. I got the error: "type List does not take parameters List words = new ArrayList();" after compilation. I searched but the syntax i use is correct, please whats wrong with the code?
import java.util.Scanner;
import java.util.ArrayList;
public class List{
public static void main(String args[]){
List<String> words = new ArrayList<String>();
Scanner input = new Scanner(System.in);
for (int i=0; i < 3; i++)
words.add(input.nextLine());
System.out.println(words);
}
}