Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

AutoCAD Database Connectivity

Authors: Scott McFarlane

1st Edition

0766816400, 978-0766816404

More Books

Students also viewed these Databases questions

Question

What is Ramayana, who is its creator, why was Ramayana written?

Answered: 1 week ago

Question

2. What process will you put in place to address conflicts?

Answered: 1 week ago