Java learning unreported exception java.io.IOException ; must be caught or declared to be thrown

Code:

public class A
{
    public void showfile() throws java.io.IOException
    {
        // do someting
    }
}

 

What the method does is:Throw IOException
So when you use/call it, you have to either catch that exception or look for it again.
For example:

try
{
    showfile();
}
catch(IOException e)
{
    e.printStackTrace();
}


Read More: