I have my code block here. It tells me the IOException is unhandled.
public static void main(String[] args) {
        FileWriter locFile = null;              
        try{                                  
            locFile = new FileWriter("locFile.txt");
            for(Location location : locations.values()){
                locFile.write(location.getLocationID()+", "+location.getDescription()+"\n");
            }
        }catch(IOException e){                     
            throw new IOException("My message");
            e.printStackTrace();
        }finally{
            try{
                if(locFile != null){
                    System.out.println("Attempting to close locFile");
                    locFile.close();
                }
            }catch(IOException e){
                e.printStackTrace();
            }
        }
    }
I think one way I can do is like this:
public static void main(String[] args) throws IOException{
   ...
}
But can I throw the exception inside the catch block? Is it practical or common to do so?