From Juneday education
Jump to: navigation, search


This weekly hand-in is supposed to cover the topics taught in the following lectures/chapters:

If you do all the exercises it should be no problem to finish this simple hand-in.

This first week is much about making sure that everyone has their computer environment set up and that they can compile and run Java programs.

Files to hand in

Write your answers in a file called answers-weekly01.txt and make sure the file contains your name. You will later hand in this file.


Create a directory called weekly01 and cd to that directory.

Expand using link to the right to see a hint.

$ mkdir weekly01
$ cd weekly01

Download the files sortiment.xml and InvestigateFile.java using wget so that the files end up in the weekly01 directory.

Use the program file to investigate the sortiment.xml file. What does file tell you about the file? Write your answer in answers-weekly01.txt.

Expand using link to the right to see a hint.

$ file sortiment.xml

Use wc -l to investigate how many lines sortiment.xml contains. Write the answer in the answers-weekly01.txt file. That is, wc followed by the flag -l ("minus l" or "dash l") as in lowercase 'L', which stands for "lines".

Expand using link to the right to see a hint.

$ wc -l sortiment.xml

Compile the program InvestigateFile.java and run it. Paste the output from the program into your answers-weekly01.txt file.

Expand using link to the right to see a hint.

$ javac InvestigateFile.java && java InvestigateFile

Hand in the file (ask your teachers for instructions on how to submit your answers).

Food for thought

What do you think the purpose of the sortiment.xml file is? What do you think its contents represent?

What file format is used? Do you understand the structure of the file?

You don't have to include these answers in your file, but it is always good to think about what you are doing. We will see a lot of this file in coming hand-ins, so it is good to start thinking about it already!