???
The variable ???x??? is different from the variable ???X.??? The class name of ???Primitive??? is different from a class name
of ???primitive.???
The next three lines ???declare??? three variables of type int. The variables x, y, and z are each int variables,
which means that each one requires 32 bits for storage, and each one represents an integer value. The
JVM will reserve the required space for x, y, and z.
The next three lines assign the value of 7 to y, 4 to z, and the sum of 7 and 4 to x.
Finally, the last line displays the characters x = and the value of x, which is 11, on the ???standard output
device,??? usually the display. The result is:
x = 11
Notice the ???curly braces??? (i.e., { ... }) in the code. One pair of curly braces surrounds the ???body??? of the
class Primitive, and one pair of curly braces inside Primitive surrounds the body of the method main.
You must use curly braces to mark the beginning and end of a ???code block??? in Java. A code block is a ???compound
statement,??? and a code block can consist of variable declarations and statements. Classes, methods, loops
(which we have not yet discussed), and control structures (which we have not yet discussed) all define code
blocks, and blocks can be nested within one another to any level.
Pages:
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192