I get the error exception java.io.IOException is never thrown in body of corresponding try statement if I try to catch an IOException. But if I use Exception instead, the error is gone. Can someone describe why this happens?
public class CmndLine { public static void main(String args[]) { int i, j = 0; long m, l; boolean b1 = false; String str = ""; String [] s; for (i = 0; i < args.length; i++) str += args[i]; File file = new File(str); try { b1 = file.exists(); System.out.println(b1); if (b1 == true) { m = file.lastModified(); l = file.length(); s = file.list(); java.util.Date d = new java.util.Date(m); System.out.println("Name : " + file.getName()); System.out.println("Parent : " + file.getParent()); System.out.println("Path : " + file.getPath()); System.out.println("Date and Time of Modification : " + d); System.out.println("Size : " + l + " Bytes"); boolean c = file.isDirectory(); if (c == true) { System.out.println(""); for (String t : s) System.out.println(t); } } } catch (IOException g) { g.printStackTrace(); } } }