adplus-dvertising
frame-decoration

Question

Which is the correct way of overriding a method throwing exceptions in Java?

a.

void show() throws IOException{ }
.
.
void show() throws FileNotFoundException{ }

b.

void show() throws IOException{ }
.
.
void show() throws ArithmeticException{ }

c.

void show() throws ArithmeticException{ }
.
.
void show() throws IllegalFormatException{ }

d.

None of the above

Posted under Java Programming

Answer: (a).void show() throws IOException{ }
.
.
void show() throws FileNotFoundException{ }

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which is the correct way of overriding a method throwing exceptions in Java?