Multiple choice technology programming languages

Select two methods that correctly override the following method? (Assume that all necessary packages have been imported). protected int aMethod(int i) throws IOException {...}

  1. int aMethod(int i) throws IOException{...}

  2. protected int aMethod(int i) throws FileNotFoundException{...}

  3. public int aMethod(int i) throws Exception{...}

  4. public int aMethod(byte i) throws IOException{...}

  5. protected int aMethod(int i) throws IOException,FileNotFoundException{...}

Reveal answer Fill a bubble to check yourself
B,E Correct answer
Explanation

An overriding method can declare narrower or fewer checked exceptions than the overridden method, or none at all. It can also increase visibility (e.g., from protected to public). Thus, throwing FileNotFoundException (a subclass of IOException) or keeping the original signature are both valid.