Question: Exercise 2 - Double Jeopardy The following program uses primitive data type double: public class Double Jeopardy { public static void main(String[] args) {

Exercise 2 - Double Jeopardy The following program uses primitive data type

Exercise 2 - Double Jeopardy The following program uses primitive data type double: public class Double Jeopardy { public static void main(String[] args) { double value = 32; System.out.println("A double: + value); } } In this program, value is the name for a variable that uses the double data type to represent floating point numbers. Recall that this data type uses 64 bits. It is perfectly OK to use the name value in this and in the previous program. A variable name helps describe what you want the program to do. It does not permanently reserve part of computer memory for any particular use. Compile and run the program. Does its output (what it puts on the screen) differ from the output of the the previous exercise? Change the 32 to 32.0 and see if that makes a difference when you compile and run the program. Now try to "break" the program. Look back in this chapter at the chart of primitive data types and the range of values they can hold. Change the "32" to a value that is too big for double. You may wish to use scientific notation for this. Click here to go back to the main menu.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!