Java Reference
In-Depth Information
throws, transient, true, try, typeof, var, volatile, void,
while,
with
These words are reserved because many of them are used by the language itself, and you
will come across them later in this topic.
Many are not used by the language, however; one can only assume they were planned to
be used at some point, but never were. There are also a few words not reserved that should
have been as they are an important part of the language:
undefined, NaN, Infinity
These are covered later in this chapter. You should also avoid using these words for variable
names.
Assignment
To assign a value to a variable, we use the = operator. This example shows how we would
set the variable name to point to the string literal "Walter" :
var name; // declare the variable first
<< undefined
name = "Walter"; // assign the variable to a string
<< "Walter"
Once the variable has been assigned a value, it is displayed in the console output.
To see the value of a variable, simply enter it in the console. The variable name now refers
to the string "Walter" , so it will behave exactly the same as that string:
name;
<< "Walter"
typeof name;
<< "string"
Search WWH ::




Custom Search