Java Reference
In-Depth Information
CAUTION
Although Java supports the transmission of Unicode characters,
the user's system also must support it for the characters to be
displayed. Unicode support provides a way to encode its charac-
ters for systems that support the standard. Java supports the dis-
play of any Unicode character that can be represented by a host
font.
For more information about Unicode, visit the Unicode Consortium
website at http://www.unicode.org.
Although string literals are used in a manner similar to other literals in a program, they
are handled differently behind the scenes.
With a string literal, Java stores that value as a String object. You don't have to explic-
itly create a new object, as you must when working with other objects, so they are as
easy to work with as primitive data types. Strings are unusual in this respect—none of
the basic types are stored as an object when used. You learn more about strings and the
String class later today and tomorrow.
Expressions and Operators
An expression is a statement that can convey a value. Some of the most common expres-
sions are mathematical, such as in the following example:
int x = 3;
int y = x;
int z = x * y;
All three of these statements can be considered expressions; they convey values that can
be assigned to variables. The first assigns the literal 3 to the variable x . The second
assigns the value of the variable x to the variable y . In the third expression, the multipli-
cation operator * is used to multiply the x and y integers, and the result is stored in the z
integer.
An expression can be any combination of variables, literals, and operators. They also can
be method calls because methods can send back a value to the object or class that called
the method.
The value conveyed by an expression is called a return value . This value can be assigned
to a variable and used in many other ways in your Java programs.
 
Search WWH ::




Custom Search