This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Here file.createNewFile() needs a try/catch block or need throws declaration in the method signature to compile where as file.isDirectory() is just fine.I expect file.isDirectory() to behave the same way as file.createNewFile() behaves.Can anyone explain this
Why would it throw an IOException if no I/O takes place? The method can throw an uncheckedSecurityException, which (obviously) is not subject to the same catch-or-declare requirement as the IOException thrown by the createNewFile() method.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.