Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

J. Other Topics > Execises

Execises

J.3 Define each of the following terms:

a. Collection

b. Collections

c. Comparator

d. List

e. HashMap

f. ObjectOutputStream

g. File

h. ObjectOutputStream

i. byte-based stream

j. character-based stream

J.4 Briefly answer the following questions:

a. What is the primary difference between a Set and a Map?

b. What happens when you add a primitive type (e.g., double) value to a collection?

c. Can you print all the elements in a collection without using an Iterator? If yes, how?

J.5 (Duplicate Elimination) Write a program that reads in a series of first names and eliminates duplicates by storing them in a Set. Allow the user to search for a first name.

J.6 (Counting Letters) Modify the program of Fig. J.9 to count the number of occurrences of each letter rather than of each word. For example, the string


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial