I'm returning to Java (Android) after a long time away in C# .NET -land, and trying to remember the various idiosyncrasies.
One that's got me stuck is this; I'm throwing an Exception in my constructor if my class fails to initialise properly, as follows:
// Constructor
public CountdownDictionary(JSONArray jsValues, ArrayList<String> returnFieldList)
{
this.DictionaryType = getDictionaryTypeFromValues(jsValues);
if (this.DictionaryType == CountdownDictionaryTypes.Unknown)
{
throw new Exception("Unknown dictionary type");
}
}
Eclipse give a compile-time error
Unhandled exception type Exception
This is confusing me; since how can I handle the exception? I don't want to handle the Exception in this class, I want it to be unhandled so that it bubbles up to the caller and they can handle it!
What am I missing?