AMAPstudio

### Sidebar

The Java training online

# 7. Write the trees in a file

Purpose: Write text in a file

Statement of the exercise:

1. build a tool method accepting in arguments a list of SpatializedTrees and a fileName, to write a line in the file per tree in the list.
2. each line contains the tree id, age, x, y, z, height, dbh, crownBaseHeight and crownRadius of the tree, all columns are separated by tabs.
3. a header line starting with a # comment mark displays the column names
4. in case of trouble, an error message is written in the terminal and the exception is thrown back to the caller.
5. write the previous exercise tree list in a file called trees.txt