Java Reference
In-Depth Information
If you come from a C/C++ background, you know that there is no restriction on the
names that you give variables declared in an inner scope. Thus, in C/C++ the declaration
of count within the block of the outer for loop is completely valid, and such a declaration
hides the outer variable. The designers of Java felt that this name hiding could easily lead
to programming errors and disallowed it.
Operators
Java provides a rich operator environment. An operator is a symbol that tells the compiler
to perform a specific mathematical or logical manipulation. Java has four general classes
of operators: arithmetic, bitwise, relational, and logical. Java also defines some additional
operators that handle certain special situations. This chapter will examine the arithmetic,
relational, and logical operators. We will also examine the assignment operator. The bitwise
and other special operators are examined later.
Arithmetic Operators
Java defines the following arithmetic operators:
Operator
Meaning
+
Addition (also unary plus)
Search WWH ::




Custom Search