This topic contains a solution. Click here to go to the answer

Author Question: Analyze the following code.import java.util.*;public class Test { public static void main(String[] ... (Read 71 times)

bobbysung

  • Hero Member
  • *****
  • Posts: 519

Question 1

Which of the following is correct to perform the set intersection of two sets s1 and s2?
◦ s1.join(s2)
◦ s1.intersection(s2)
◦ s1.intersect(s2)
◦ s1.retainAll(s2)

Question 2

Analyze the following code.

import java.util.*;

public class Test {
public static void main(String[] args) throws Exception {
Set set = new TreeSet();

set.add("Red");
set.add("Green");
set.add("Blue");

System.out.println(set.first());
}
}

◦ The program displays Blue
◦ The program may display Red, Blue, or Green.
◦ The program displays Red
◦ The program displays Green
◦ The program cannot compile, because the first() method is not defined in Set.


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by bobbysung on May 6, 2020

memslove

  • Sr. Member
  • ****
  • Posts: 321
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 25% of students answer this correctly




bobbysung

  • Member
  • Posts: 519
Reply 2 on: May 6, 2020
YES! Correct, THANKS for helping me on my review


ktidd

  • Member
  • Posts: 319
Reply 3 on: Yesterday
:D TYSM

 

Did you know?

Atropine was named after the Greek goddess Atropos, the oldest and ugliest of the three sisters known as the Fates, who controlled the destiny of men.

Did you know?

Cyanide works by making the human body unable to use oxygen.

Did you know?

Cytomegalovirus affects nearly the same amount of newborns every year as Down syndrome.

Did you know?

There are more nerve cells in one human brain than there are stars in the Milky Way.

Did you know?

Acetaminophen (Tylenol) in overdose can seriously damage the liver. It should never be taken by people who use alcohol heavily; it can result in severe liver damage and even a condition requiring a liver transplant.

For a complete list of videos, visit our video library