Oracle
1Z0-819 · Question #7
Given: import java.util.; public class Foo { public public List<Number> foo(Set<CharSequence> m) { ... } } and import java.util.; public class Bar extends Foo { //line 1 } Which two statements can…
The correct answer is B. public ArrayList<Number> foo(Set<CharSequence> m) { ... } C. public List<Number> foo(TreeSet<String> m) { ... }. See the full explanation below for the reasoning.
Question
Given:
import java.util.;
public class Foo {
public public List<Number> foo(Set<CharSequence> m) { ... }
}
and
import java.util.;
public class Bar extends Foo {
//line 1
}
Which two statements can be added at line 1 in Bar to successfully compile it? (Choose two.)
Options
- Apublic List<Integer> foo(Set<CharSequence> m) { ... }
- Bpublic ArrayList<Number> foo(Set<CharSequence> m) { ... }
- Cpublic List<Number> foo(TreeSet<String> m) { ... }
- Dpublic List<Integer> foo(Set<String> m) { ... }
- Epublic List<Number> foo(Set<Comparable> m) { ... }
- Fpublic ArrayList<Integer> foo(Set<String> m) { ... }
How the community answered
(39 responses)- A3% (1)
- B79% (31)
- D10% (4)
- E3% (1)
- F5% (2)
Community Discussion
No community discussion yet for this question.