Multiple Choice Question

Quiz Guidelines

 

QID: 
553
Question: 

How can you fix the following code to make it compile?

import java.io.*;
class Great {
    Public void doStuff() throws FileNotFoundException{
    }    
}
class Amazing extends Great { 
  public void doStuff() throws IOException, IllegalArgumentException
  }    
}
public class TestClass {
    public static void main(String[] args) throws IOException{
        Great g = new Amazing();
        g.doStuff();
    }
}

Assume that changes suggested in a option are to be applied independent of other options.

Select 2 options

A. Change do Stuff in Amazing to throw only Illegal Argument Exception.
B. Change do Stuff in Great to throw only File Not Found Exception as well as Illegal Argument Exception.
C. Change do Stuff in Amazing to throw only IO Exception.
D. Change do Stuff in Great to throw only IO Exception instead of File Not Found Exception.
E. Replace g.doStuff() to ((Amazing) g).do Stuff ().

Q&A Set: 

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!