LeonHardd - 2009-12-10

Introducing persistence – lesson I  - try-catch use improvement

Hi Mark,

First of all, I extremely want to thank you about the efficient and lovely tutorials that you have created.
I want to indicate you that it is possible to improve the explanation of how the try-catch statements works (Introducing persistence – lesson I  - try-catch use @ 10:55) by adding some line of printing code above and bottom the division, just like I have done:

    long x= 1;
   
    try
    {
    x= 9876;
    System.out.println("this line will be ALWAYS print !");
   
    x = 1 / 0;
   
    System.out.println("this line will be NEVER print! every instruction bottom this point will never be reached");
    x= -1234;
   
    }
    catch(ArithmeticException ae)
    {
    x= 77; // i think that is better using a value different from 0 to set x, just after a zero divide!
    System.out.println("can not divide by zero!");
    }
    System.out.println("this line will be print x= "+ x);

I hope my small indication could help you to make a little clearer the explanation..
I will be happy if there will be continue in other tutorial issues for Java and Eclipse.
Thanks for your efforts!

PS: actually I’m learning Repast Simphony (http://repast.sourceforge.net/), so I have started to learn eclipse, is there any guide for it?
Thanks a lot!!