나는 목록을 알파벳순으로 프로그램을 만드는 노력은, Collections.sort 방법과 java.util.List를 사용하고, 오류는 다음과 같습니다 1 오류 15 경고가 발견Java에서 오류 번호 및 경고 - 경고 및 경고?
Error: java.util.List is abstract; cannot be instantiated
--------------
** Warnings **
--------------
Warning: unchecked call to add(E) as a member of the raw type java.util.List
Warning: unchecked method invocation: method sort in class java.util.Collections is applied to given types
required: java.util.List<T>
found: java.util.List
내 코드 :
public static void preset(){
List words= new List();
words.add("apple");
words.add("country");
words.add("couch");
words.add("shoe");
words.add("school");
words.add("computer");
words.add("yesterday");
words.add("wowza");
words.add("happy");
words.add("tomorrow");
words.add("today");
words.add("research");
words.add("project");
Collections.sort(words);
} //end of method preset
감사하며, 내가 어떻게이 새로운 정렬 된 목록을 인쇄하는 방법 :
그냥 다음과 같은 문제를 해결? 메인의 메서드를 호출하여 인쇄하려고했지만 작동하지 않습니다. – user2399999
어떻게 작동하지 않는지 게시 할 수 있습니까? System.out.println (단어)로 충분해야합니다. –