Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1 Are there any compile errors in (a) and (b)? Briefly explain your answer ArrayList dates - new ArrayList (); dates.add (new Date());
Question 1 Are there any compile errors in (a) and (b)? Briefly explain your answer ArrayList dates - new ArrayList (); dates.add (new Date()); dates.add (new String()); ArrayList dates - new ArrayList (); dates.add(new Date()); dates.add(new String()); (b) Question 2 Suppose that set1 (Set ) is a set that contains the strings "red", "yellow", "green", and that set2 (Set ) is another set that contains the strings "red", "yellow", "blue". Answer the following questions: (All the questions are independent) 1. What is set1 after executing set1.addAll(set2)? 2. What is set1 after executing set1.add(set2)? 3. What is set1 after executing set1.removeAll(set2)? 4. What is set1 after executing set1.remove(set2)? 5. What is set1 after executing set1.retainAll(set2)?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Solution for the above question is Question 1 a Code ArrayList datesnew ArrayList datesaddnew Date d...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started