You are going to read about some code that is fully described but not fully shown and determine if various code fragments would result in a compiler error, a run-time error (sometimes), or always compile and run correctly. Ideally, you will attempt to determine the correct answer simply by looking at the giving code then, after answering the questions you will implement the specified interfaces, classes, and develop tests for each of the fragments to determine the correct answer.
You are encouraged to use the specified
code as a platform to explore more code fragments of your own design to
increase your awareness of the issues and concepts explored by this lab.
After filling out (or just writing down) the table in the handout with your best answers:
In a file called Tests.java, write tests for each code fragment to see if you answers were correct.
Remember: Some will not compile. You will have to comment them out to continue your testing.
Remember: Some will compile but fail at run-time. You will have to comment out the ones that fail at run-time to continue your testing.
Lab courtesy of Kurt Mammen.