Question: 1 . Create an interface called Items. It should define at least the following methods: a . public void add ( Object item ) -

1.Create an interface called Items. It
should define at least the following
methods:
a. public void add( Object
item )- adds a single
object to the collection.
b. public Object get ( int
index )- returns an item at
a specific index.
c. public int size()-
returns the number of items
stored in the collection.
d. public void addAll(
Object[] items )- adds
all of the elements in the
array to the collection.
2.Write a class called
AbstractItems that implements
the Items interface. It should
provide concrete implementations
of at least the following methods:
a. public void addAll(
Object[] items )-This
should simply loop and call
the add method for each
item in the array.
b. public String
toString()- returns a
string that lists all of the
items on a single line. For
example, if the collection
contained the strings "abc",
"123", and "cat" the
toString method should
return something like "abc
123 cat". This method
should use a loop and call
the get method.
1 . Create an interface called Items. It should

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 Programming Questions!