Ch 2 Questions #1

 

Primitive Types

 

 

 

 

1.         How many primitive types are there and what are their names and reserved words.

 

2.         In a program you declare a boolean data type and then set it equal to 1 (e.g. boolean  boo = 1 ;).   You then attempt to to print out the variable.  What will happen?

 

3.         How do you declare a character data type and assign a value to it?

 

4.         What is the difference between an integer and a double?

 

5.         You declare an integer (e.g. int i) and then set the variable equal to 10.87.  What will happen?

 

6.         result = 14 + 8 / 2  will produce what value in result?

 

7.         result = 28 % 3 will produce what value in result?

 

8.         How do you convert an integer type into a double?

 

9.         Suppose you divided two integers say 8 divided by three and placed the result into an integer type result.  What will be the value of result?

 

10.       How do make a constant in Java?