Hello. I'm new to Java (as you can notice ...) and I'm starting with some simple programs. I've tested a program I got from a book and I'm getting a compile error I don't quite understand (don't understand what's wrong ...). I'm using SUN jdk1.2.2 Can anyone please help ?
Thanks
<this is the java code>
import java.io.*;
import java.util.*;
public class DirList {
public static void main (String[] args) {
File path = new File("."
String[] list;
list = path.list();
for (int i = 0; i < list.lenght; i++)
System.out.println(list);
}
}
<this is the compiler error>
DirList.java:18: Attempt to reference field lenght in a java.lang.String[].
for (int i = 0; i < list.lenght; i++)
^
1 error
Thanks
<this is the java code>
import java.io.*;
import java.util.*;
public class DirList {
public static void main (String[] args) {
File path = new File("."
String[] list;
list = path.list();
for (int i = 0; i < list.lenght; i++)
System.out.println(list);
}
}
<this is the compiler error>
DirList.java:18: Attempt to reference field lenght in a java.lang.String[].
for (int i = 0; i < list.lenght; i++)
^
1 error