In Java programming, I used the list as usual, but sometimes I get the following error:

This is because I'm using java.awt.List instead of java.util.List as the list.
It is a GUI part of Abstract Windows Toolkit used when creating GUI in Java, so-called ** list box **. Not a list of Java collections.

import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.List;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class AwtEx {
	AwtEx(){
		List awtList = new List();
		awtList.add("item01");
		awtList.add("item02");
		awtList.add("item03");
		
		Frame frame = new Frame();
		frame.add(awtList);
		frame.setSize(200, 200);
		frame.setLayout(new FlowLayout());
		frame.setVisible(true);
		
		frame.addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent we) {
				frame.dispose();
			}
		});
	}
	
	public static void main(String[] args) {
		new AwtEx();
	}
}
You can avoid using java.awt, but I think it will be easier if you set it in the development environment so that java.awt does not appear as shown in the link below.