An address database, Winter 2016

Consider executing java -jar

Current person records:

0: Frank Bone, email:, phone: 885-11-87
1: Julius Caesar, email: -, phone: -
2: Clive Freemantle, email:, phone: 112-22 33 12
3: Eve Gardener, email: -, phone: 32-44-2234
Main options:

0: Browse person entries 
1: Toggle filtering person entries 
2: Create new person entry 
3: Delete person entry 
4: Exit
Your choice: 2

List all person records within your database. In presence of a filter (See ) only a subset of entries will be displayed.

For large person databases listing all entries becomes cumbersome. You may want to define filters limiting your visible result output by examining the last name attribute.

Java allows for matching strings by regular expressions to be used with e.g. String.matches(...). Examples:


Strings starting (^) with capital A followed by an arbitrary number of arbitrary characters.


Strings starting with a capital letters G,H,I or J followed by an arbitrary number of arbitrary characters.


Strings ending with character s.

Creating a new person record

Deleting a person record from your database

In order for entries to survive program termination we need a persistence mechanism. The example application will create a new file address.txt on first invocation when adding at least one person:

Frank,Bone, ,885-11-87
Julius,Caesar, , 
A,B, ,24
Eve,Gardener, ,32-44-2234

Each person record is being represented by four values being separated by three commas. Empty attribute values require a single space. The method String.split(...) is your friend when reading this file on program startup using , as separator split token.

The following resources may help you getting started with Java file input/output: