Complete this assignment with Team One.
You must submit this in an archive named "wlazy.zip".
You must submit this in a file named "wlazy.pdf".
Is Java eager or lazy? Write a Java program to determine the answer to this question. The same program, run under the two different regimes, should produce different results. You may use any Java features you want, but keep your program relatively short; we will penalize you for programs we consider excessively long or obfuscatory. (Tip: It’s possible to solve this problem with a program no more than a few dozen lines long.)
You must turn in both the source code to your program (in printed or written form) as well as an answer to the question of whether Java is eager or lazy, and an explanation of how your program determines this. That is, you should provide a brief and unambiguous answer (e.g., “Java is lazy.”) followed by a description of what result one would obtain under each regime, along with a brief explanation of why that regime would generate that result.
In general, it would be a good idea to discuss your plan of attack with the course staff. This will help you avoid falling into a trap of measuring the wrong entity, and will improve your understanding of eagerness and laziness.
No lazy language in history has also had state operations (such as mutating the values in boxes, or assigning values to variables). Why not?
The best answer to this question would include two things: a short program (which we assume will evaluate in a lazy regime) that uses state, and a brief explanation of what problem the execution of this program illustrates. Please be sure to use the non-caching (ie, original) notion of laziness. If you present a sufficiently illustrative example (which needn’t be very long!), your explanation can be quite short.
In 850 words or less, describe if and how your knowledge of lazy evaluation will help you in your future programming practice. Good answers might discuss how this concept can be applied in interesting programming environments or how knowledge of its subtleties clarifies or improves existing practices, techniques, tools, etc.