Question
JAVA: public class test2 { public static void main (String[] argv) { System.out.println( (double) (int) 3.1415 ); int i = 10; while (i >= 1)
JAVA: public class test2 { public static void main (String[] argv) { System.out.println( (double) (int) 3.1415 ); int i = 10; while (i >= 1) System.out.println(i); --i; } }
Perform a paper and pencil trace of the specified code. Execute the program as if you are the CPU and state the output exactly as if the computer exectued it. You must be able to successfully answer these types of questions using a paper and a pencil!
For example: In the first iteration of the loop, the value of someVariable1 is blah blah, the value of someVariable2 is blah blah. In the second iteration of the loop, the value of someVariable1 is.....
By doing this for the first two or three iterations, you should be able to generalize and then give a couple of sentences, what you expect the final answer (if any?) to be. If the loop does not terminate, that is it runs in an infinite loop, then explain why do you think that is the case.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started