Java OCA OCP Practice Question 3266

Question

In a class that extends ListResourceBundle, which one of the following method definitions correctly overrides the getObject() method of the base class?

a)  public String[][] getContents() {
        return new Object[][] { { "1", "Uno" }, { "2", "Duo" }, { "3", "Trie" }};
    }//from w  w  w.j  a va2  s  .com

b)  public Object[][] getContents() {
        return new Object[][] { { "1", "Uno" }, { "2", "Duo" }, { "3", "Trie" }};
    }

c)  private List<String> getContents() {
        return new ArrayList (Arrays.AsList({ { "1", "Uno" }, { "2", "Duo" },
        { "3", "Trie" }});
    }

d)  protected Object[] getContents(){
        return new String[] { "Uno", "Duo", "Trie" };
    }


b)

Note

The getContents() method is declared in ListResourceBundle as follows:

protected abstract Object[][] getContents()

The other three definitions are incorrect overrides and will result in compiler error(s).




PreviousNext

Related