/1. How much memory is being reserved here? 32 bit.                         //Throw an error message on line 52 by making x a constant.                         int x = 999;                         ++x; //++x is a shortcut for x = x + 1 or x+=1                         System.out.println(x);                         */                                                                                                 /**                         //2. if I don't assign it anything what goes in there? we will get an error.                         // NOW local variable. (Look stack flow link)                         //Discuss this and come up with a theory.                         //Why is this a bad idea.                         int x;                         System.out.println(x);                         */                               //3. How could this be useful?                         //Why is there a limit?                                                 System.out.println(Integer.MAX_VALUE);                         System.out.println(Integer.MIN_VALUE);                                                 System.out.println(Double.MAX_VALUE);                         System.out.println(Double.MIN_VALUE);                         /*

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please explain the questions below:

//1. How much memory is being reserved here? 32 bit.

                        //Throw an error message on line 52 by making x a constant.

                        int x = 999;

                        ++x; //++x is a shortcut for x = x + 1 or x+=1

                        System.out.println(x);

                        */

                       

                       

                       

                        /**

                        //2. if I don't assign it anything what goes in there? we will get an error.

                        // NOW local variable. (Look stack flow link)

                        //Discuss this and come up with a theory.

                        //Why is this a bad idea.

                        int x;

                        System.out.println(x);

                        */

 

 

 

                        //3. How could this be useful?

                        //Why is there a limit?

                       

                        System.out.println(Integer.MAX_VALUE);

                        System.out.println(Integer.MIN_VALUE);

                       

                        System.out.println(Double.MAX_VALUE);

                        System.out.println(Double.MIN_VALUE);

                        /*

                       

                       

                //4. For each line:

                        //uncomment the print statement and the run each line one at a time by

                        //commenting one back in and then back out.

                        //                     predict what's going to happen

                        //                     observe the actual results

                        //                     explain what's going on if you can

                       

                        int x = 4.6; //What is this type of conversion called?

                int x = (int)4.6; //What is this type of conversion called?

                        int x = 9/4;

                       

                        //System.out.println(x);

                       

                        //5. Explain what's going on

                        /*

                        double y = 5.8;

                        //int x = y;

                        int x = (int) y;

                       

                        System.out.println(x);

                        System.out.println(y);

                        */

                       

                        //6. Explain what's going on. When would you use this data type?

                        /*

                        byte x = 126;

                        System.out.println(x);

                        x = 127; x++;

                        System.out.println(x);

                        */

                       

                        //7. Explain what's going. on. When would you use this data type?

                        /*

                        //short x = 32768;

                        //System.out.println(x);

                        short x = 32767; x++;

                        System.out.println(x);

                        */

                       

                        //8. Experiment with the below code. When would you use this data type?

                        // In Java "or" is represented by || and "and" is represented as &&

                        //boolean x = 0;

                //boolean x = true;

                        //x = !x;

                        //x = x || false;

                       

                        //System.out.println(x);

                       

                       

                        //9. Explain what's going on here.

                        //char x = 'A';

                        //char x = 65;

                        //char x = 'A'; x++;

                        //char x = 12;                     

                        //System.out.println("x = " + x);

Expert Solution
steps

Step by step

Solved in 4 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education