Java Reference
In-Depth Information
Answers to Review Questions
1.
goto and const.
2.
true or false.
3.
False. main is the name of the method that the JVM invokes on a standalone Java
application, but main is not a keyword.
4.
True.
5.
byte (8 bits), short (16 bits), int (32 bits), long (64 bits), float (32 bits), double (64 bits),
char (16 bits), boolean (size is not defined).
6.
False. Unsigned is not a Java keyword.
7.
class. We will do this throughout the remainder of the topic.
8.
False. The “underlying platform” is always a JVM, and an int is 32 bits on all JVMs.
9.
final. Variables declared as final cannot be changed.
10.
A String object.
11.
True. A String object cannot be changed.
12.
reference.
13.
True. A reference holds a memory address, but you cannot use this fact in your Java
programs.
14.
6. This is integer division, so the result is an int. Any remainder is truncated.
15.
-6. The right-shift operator is equivalent to integer division by 2, so shifting twice is
equivalent to integer division by 4. -24/4 equals -6.
16.
1. 10 is greater than zero, so the value of y is the expression immediately following the
question mark.
17.
// is used for single-line comments, /* ... */ is used for commenting multiple lines, and
/** ... */ is used for javadoc comments.
Search WWH ::




Custom Search