I just want to know what happens when this code is written:
public static void main(String[] args) throws IOException

You will not be obligated to write something like:

try {

} catch(IOException io) {

}

in your code. Meaning that if a method throws an IOException you will not have to catch it but if it is thrown there will be no place for the exception to "go" since nothing calls main(), so the program will end with exception.

And for that reason, you shouldn't ever throw exceptions from main().

Thank you.

You will not be obligated to write something like:

try {

} catch(IOException io) {

}

in your code. Meaning that if a method throws an IOException you will not have to catch it but if it is thrown there will be no place for the exception to "go" since nothing calls main(), so the program will end with exception.

Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.