1. In the pub.

Make the exercise in the document below.

Think test driven. So write tests, then code. Testing is ensuring the code is usable as in testable is a design exercise. If you cannot test it, you cannot properly use it.

2. Exceptions 1

What is the effect of the code below? It may be wrong.

  1. Explain what happens what will happen.

  2. Feed it to the compiler, e.g. by using NetBeans and see what the compiler thinks of it. Explain any messages you may get.

This is an exercise in RTFCM (Read The Fine Compiler Messages).

Do not repair the code if it appears broken.
something with Exceptions
class X {
  void m(){
    Object e = new RuntimeException("lets rock the world");
    throw e;
  }
}

3. Exceptions 2

What is the effect of the code below? It may be wrong.

  1. Explain what happens what will happen.

  2. Feed it to the compiler, e.g. by using NetBeans and see what the compiler thinks of it. Explain any messages you may get.

This is an exercise in RTFCM (Read The Fine Compiler Messages).

Do not repair the code if it appears broken.
something with Exceptions
class Y {
  void m(){
    Exception e = new Exception("got you this time");
    try {
      throw e;
    } catch( e ) {
      System.out.println(e.getMessage());
      throw e;
    }
  }
}