Answer:

Double value = 2.5;

double sum = value + 5.7;

Yes, it works. It is shorthand for

Double value = new Double( 2.5 );

double sum = value.doubleValue() + 5.7;

Phone Book Application

ArrayLists are especially convenient when you want to maintain a list of your own object types. For example say that you want an application that maintains a phone book. Each entry in the phone book contains a name and a number, along with various methods.

class Entry
{
  private String name;
  private String number;

  // constructor
  Entry( String n, String num )
  {
    name = n; number = num;
  }

  // various methods
  . . .
}

Our program will maintain an ArrayList of phone book entries. The user will type in a name and get a phone number.

QUESTION 20:

Suggest some methods that will be useful for Entry.