Hallo,
Wieso funktioniert das mit f1 nicht?
Vg Erdal
Java:
import java.io.File;
import java.util.Arrays;
public class FileTest {
public static void main(String[] args) {
File f1 = new File("");
File f2 = new File(f1.getAbsolutePath());
System.out.println(Arrays.asList(f2.list()).toString());
System.out.println(Arrays.asList(f1.list()).toString());
}
}
Code:
[.classpath, .project, AndereKlasse.java, build.xml, ChangeLog, ClassExample.java, CompareAWTandSwing.java, AndereKlasse.class, ...]
Exception in thread "main" java.lang.NullPointerException
at java.util.Arrays$ArrayList.<init>(Unknown Source)
at java.util.Arrays.asList(Unknown Source)
at FileTest.main(FileTest.java:11)
Wieso funktioniert das mit f1 nicht?
Vg Erdal