I am working with the following code in Eclipse:
public class Foo {
public static final Bar bar = new Bar(20);
}
public class Bar {
public int value;
// This needs to be able to be called in places other than
// just Foo, and there it will need to throw.
public Bar(int value) throws Exception {
if(value == 0) {
throw Exception("Error. Value cannot be 0 when constructing Bar.");
}
return;
}
}
This gives me an error message in Foo (line 2) which says, "Unhandled exception type Exception", even though in practice, this exception will never occur with this code. Can I disable this error in Eclipse so it doesn't bother me, or is there another way I can deal with this error?
Thanks ahead of time for the answers!