Which two code fragments, inserted independently at line 5, will compile without warnings?

Given:

3. import java.util.*;
4. public class Hancock {
5. // insert code here
6. list.add(“foo”);
7. }
8. }

Which two code fragments, inserted independently at line 5, will compile without warnings?
(Choose two.)

Given:

3. import java.util.*;
4. public class Hancock {
5. // insert code here
6. list.add(“foo”);
7. }
8. }

Which two code fragments, inserted independently at line 5, will compile without warnings?
(Choose two.)

A.
public void addStrings(List list) {

B.
public void addStrings(List<String> list) {

C.
public void addStrings(List<? super String> list) {

D.
public void addStrings(List<? extends String> list) {



Leave a Reply 0

Your email address will not be published. Required fields are marked *