Dear programmers,
how can I create a new List?
error: java.util.List is abstract; cannot be instantiated
I know that it means, that I can't create an instance like default. But what does abstract mean and how do I have to handle it? German answers are welcome, too.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | import greenfoot.*; import java.io.Serializable; import java.util.*; /** * not finished */ public class Save implements Serializable { private List<Object>files; private static final String obPath = "CCE_ProjectFiles_Objects" , nmPath = "CCE_PojectFiles_Names" ; private String name; public Save(String name){ this .name = name; files = new List(); } public void addFile(Object file){ files.add(file); } public List getFiles(){ return files; } public static String getObjectFilePath(){ return obPath; } public static String getNameFilePath(){ return nmPath; } public void deleteFile(Object delete){ files.remove(delete); } public void save(){ Serialization.serialize( this , name); } } |