A
alex.korsak
Hello. I have something bugs, i am dummy in java.
Source:
import java.io.File;
import java.io.FilenameFilter;
public class Main {
public static void main(String[] args) {
File f = new File("C:\\Windows");
String[] strings = f.list( new FilenameFilter() { // throw exception
public boolean accept(File arg0, String arg1) {
if (new File(arg0.getAbsolutePath()).isDirectory())
return true;
return false;
}
});
for (String value : strings) {
System.out.println( value );
}
}
}
simple scan directory. i must printing name of directory.
but this code is printing all files and directories in C:\Windows\
Source:
import java.io.File;
import java.io.FilenameFilter;
public class Main {
public static void main(String[] args) {
File f = new File("C:\\Windows");
String[] strings = f.list( new FilenameFilter() { // throw exception
public boolean accept(File arg0, String arg1) {
if (new File(arg0.getAbsolutePath()).isDirectory())
return true;
return false;
}
});
for (String value : strings) {
System.out.println( value );
}
}
}
simple scan directory. i must printing name of directory.
but this code is printing all files and directories in C:\Windows\