Whenever I import java.awt.* and try to use a List
I get an error.
Is there any way to import java.awt.* and use a List?
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.
There is an ambiguity in the naming conventions of List in class awt and util, so we can handle it in 2 ways:
Use import
import java.awt.*;import java.util.List;import java.util.*;Use the full path, as mentioned in Head First Java,”either use import or the full name”
java.util.List<String> list = new java.util.ArrayList<String>();