here is the program that i tried to compile...
import java.io.*;
class Writer4 {
public static void main(String... args) {
try {
String[] files = new String[50];
File search = new File("newDir");
files = search.list();
for(String fn: files)
System.out.println("Found:: " + fn);
}
catch(IOException e) {
e.printStackTrace();
}
}
} I got this unusual complier error::
Writer4.java:17: exception java.io.IOException is never thrown in body of corresponding try statement
catch(IOException e) {
but if i remove the try-catch block it complies fine!!!
why there is no need to enclose the code in try-catch block even though we are dealing with files..??
[ June 22, 2007: Message edited by: Priyam Srivastava ]