Question: 1) Given the following code snippet: public HashMap copyFromArrayListToHashMap(ArrayList objects) { HashMap result=new HashMap (); for(int i=0;i

1)

Given the following code snippet:

public HashMap copyFromArrayListToHashMap(ArrayList objects)

{

HashMap result=new HashMap<>();

for(int i=0;i

{

result.put(i, objects.get(i));

}

return result;

}

Which of the following method invocation statements is valid in java (knowing that students is an ArrayList of type Student and fp is an object the class where the method copyFromArrayListToHashMap is defined)

a.

HashMap studentsHashMap=fp.copyFromArrayListToHashMap(E);

b.

HashMap studentsHashMap=fp.copyFromArrayListToHashMap(students);

c.

HashMap studentsHashMap=fp.copyFromArrayListToHashMap(students);

d.

HashMap studentsHashMap=fp.copyFromArrayListToHashMap(students)

2)

The statement:

public final class Circle extends Shape implements Comparable indicates that:

Select one:

a.

The class Shape is automatically implementing the class Circle

b.

The class Shape is automatically implementing the interface Comparable

c.

The class Shape is automatically implementing the interface Circle

d.

None of these

3)

The following is a valid HashMap declaration statement:

private HashMap wordsPart1;

Select one:

True

False

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!