Unchecked Exception - Online Code


What happens if a method declares an unchecked exception? Some people seem to think that declaring a method in a throws clause is what makes it "checked". As we see here, this is not the case; checked-ness has only to do with an exception's place in Java's class inheritance hierarchy.

Source Code

public class ThrowsUnchecked {

  public static void main(String[] argv) {

    new ThrowsUnchecked().doTheWork();



  public void doTheWork() {

    String s = " 42";

    int i = testit(s);  //
... (login or register to view full code)

To view full code, you must Login or Register, its FREE.

Hey, registering yourself just takes less than a minute and opens up a whole new GetGyan experience.


No comment yet. Be the first to post a comment.