Tag Archives: method

Given: (Exhibit) Which two statements are true if the method is added to Bar? (Choose two.)

Given:Which two statements are true if the method is added to Bar? (Choose two.) A. public Collection<String> foo(Collection<String> arg) { … } overrides Foo.foo. B. public <T> Collection<T> foo(Collection<T> arg) { … } overloads Foo.foo. C. public <T> List<T> foo(Collection<T> arg) { … } overrides Foo.foo. D. public <T> Iterable<T> foo(Collection<T> arg) { … } overrides Foo.foo. E.… Read More »

Given the code fragment: Which two code snippets inserted independently inside print method print Mondial:

Given the code fragment:Which two code snippets inserted independently inside print method print Mondial: domainmodal? A. new Main (} .prefix + new Main().name B. Main.prefix + Main.name C. prefix + Main, name D. prefix + getName E. Main.prefix + Main.getName() F. prefix + name Correct Answer: A,C

Analyze the code: (Exhibit) Which two options can you insert inside println method to produce Global:namescope?

Analyze the code:Which two options can you insert inside println method to produce Global:namescope? (Choose two.) A. new Test().prefix+new Test().name B. prefix+name C. Test.prefix+Test.getName() D. Test.getName+prefix E. Test.prefix+Test.name F. prefix+Test.name Correct Answer: A,C

Assuming the Widget class has a getPrice method, this code does not compile: (Exhibit) Which two statements,

Assuming the Widget class has a getPrice method, this code does not compile:Which two statements, independently, would allow this code to compile? (Choose two.) A. Replace line 4 with Stream<Widget> widgetStream = widgets.stream();. B. Replace line 5 with widgetStream.filter(a > ((Widget)a).getPrice() > 20.00). C. Replace line 1 with List<Widget> widgetStream = widgets.stream();. D. Replace line 5 with widgetStream.filter((Widget… Read More »

Given: (Exhibit) and (Exhibit) Which two method definitions at line n1 in the Bar class compile? (Choose

Given:andWhich two method definitions at line n1 in the Bar class compile? (Choose two.) A. public List<Object> foo(Set<CharSequence> m) {…} B. public List<Integer> foo(Set<CharSequence> m) {…} C. public List<Number> foo(Set<String> m) {…} D. public ArrayList<Integer> foo(Set<String> m) {…} E. public List<Integer> foo(TreeSet<String> m) {…} F. public ArrayList<Number> foo(Set<CharSequence> m) {…} Correct Answer: E,F

Given: (Exhibit) Which two statements are true if the method is added to Bar? (Choose two.)

Given:Which two statements are true if the method is added to Bar? (Choose two.) A. public <T> Collection<T> bar(Collection<T> arg) { … } overloads Foo.foo. B. public <T> Collection<T> foo(Collection<T> arg) { … } overloads Foo.foo. C. public <T> Iterable<T> foo(Collection<T> arg) { … } overrides Foo.foo. D. public <T> Collection<T> foo(Stream<T> arg) { … } overloads Foo.foo.… Read More »

Given the code fragment: Which two code snippets inserted independently inside print method print Mondial:

Given the code fragment:Which two code snippets inserted independently inside print method print Mondial: domainmodal? A. prefix + getName B. prefix + Main, name C. new Main (} .prefix + new Main().name D. Main.prefix + Main.getName() E. prefix + name F. Main.prefix + Main.name Correct Answer: B,C