Answered step by step
Verified Expert Solution
Link Copied!

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());

image

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Management and Cost Accounting

Authors: Colin Drury

8th edition

978-1408041802, 1408041804, 978-1408048566, 1408048566, 978-1408093887

More Books

Students also viewed these Programming questions