Im trying to delete TXT-files, but I always get the same error message. It's nearly the same code as the one I found on the Internet.
for (int i = 0; i < datei.length; i++)
{
try
{
loeschenDatei = datei[i].delete();
if (loeschenDatei)
{
System.out.println(datei[i] + " wurde geloescht!");
}
else
{
System.out.println(datei[i] + " konnte nicht geloescht werden!");
}
}
catch (IOException ex)
{
ex.printStackTrace();
}
}
I always get the error:
unreachable catch block for ioexception. this exception is never thrown from the try statement body.