AhmadLang / Java, How To Program, 2004
.pdf
[Page 1398]
Appendix A. Operator Precedence Chart
Section A.1. Operator Precedence
[Page 1398 (continued)]
A.1. Operator Precedence
Operators are shown in decreasing order of precedence from top to bottom (Fig. A.1).
Figure A.1. Operator precedence chart.
[Page 1399]
Operator |
Description |
Associativity |
|
|
|
++ |
unary postfix increment |
right to left |
-- |
unary postfix decrement |
|
++ |
unary prefix increment |
right to left |
-- |
unary prefix decrement |
|
+ |
unary plus |
|
- |
unary minus |
|
! |
unary logical negation |
|
~ |
unary bitwise complement |
|
( type ) |
unary cast |
|
* |
multiplication |
left to right |
/ |
division |
|
% |
remainder |
|
+ |
addition or string concatenation |
left to right |
- |
subtraction |
|
<< |
left shift |
left to right |
>> |
signed right shift |
|
>>> |
unsigned right shift |
|
< |
less than |
left to right |
<= |
less than or equal to |
|
> |
greater than |
|
>= |
greater than or equal to |
|
instanceof |
type comparison |
|
== |
is equal to |
left to right |
!= |
is not equal to |
|
|
|
|
& |
bitwise AND |
left to right |
|
boolean logical AND |
|
^ |
bitwise exclusive OR |
left to right |
|
boolean logical exclusive OR |
|
| |
bitwise inclusive OR |
left to right |
|
boolean logical inclusive OR |
|
&& |
conditional AND |
left to right |
|| |
conditional OR |
left to right |
?: |
conditional |
right to left |
= |
assignment |
right to left |
+= |
addition assignment |
|
-= |
subtraction assignment |
|
*= |
multiplication assignment |
|
/= |
division assignment |
|
%= |
remainder assignment |
|
&= |
bitwise AND assignment |
|
^= |
bitwise exclusive OR assignment |
|
|= |
bitwise inclusive OR assignment |
|
<<= |
bitwise left shift assignment |
|
>>= |
bitwise signed-right-shift assignment |
|
>>>= |
bitwise unsigned-right-shift assignment |
|
|
|
|
[Page 1400]
Appendix B. ASCII Character Set
Figure B.1. ASCII Character Set.
|
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
|
|
|
|
|
|
|
|
|
|
|
0 |
nul |
soh |
stx |
etx |
eot |
enq |
ack |
bel |
bs |
ht |
1 |
nl |
vt |
ff |
cr |
so |
si |
dle |
dc1 |
dc2 |
dc3 |
2 |
dc4 |
nak |
syn |
etb |
can |
em |
sub |
esc |
fs |
gs |
3 |
rs |
us |
sp |
! |
" |
# |
$ |
% |
& |
' |
4 |
( |
) |
* |
+ |
, |
- |
. |
/ |
0 |
1 |
5 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
: |
; |
6 |
< |
= |
> |
? |
@ |
A |
B |
C |
D |
E |
7 |
F |
G |
H |
I |
J |
K |
L |
M |
N |
O |
8 |
P |
Q |
R |
S |
T |
U |
V |
W |
X |
Y |
9 |
Z |
[ |
\ |
] |
^ |
_ |
' |
a |
b |
c |
10 |
d |
e |
f |
g |
h |
i |
j |
k |
l |
m |
11 |
n |
o |
p |
q |
r |
s |
t |
u |
v |
w |
12 |
x |
y |
z |
{ |
| |
} |
~ |
del |
|
|
|
|
|
|
|
|
|
|
|
|
|
The digits at the left of the table are the left digits of the decimal equivalent (0127) of the character code, and the digits at the top of the table are the right digits of the character code. For example, the character code for "F" is 70, and the character code for "&" is 38.
Most users of this book are interested in the ASCII character set used to represent English characters on many computers. The ASCII character set is a subset of the Unicode character set used by Java to represent characters from most of the world's languages. For more information on the Unicode character set, see Appendix F.
[Page 1401]
Appendix C. Keywords and Reserved Words
Figure C.1. Java keywords.
Java Keywords
abstract |
assert |
boolean |
break |
byte |
case |
catch |
char |
class |
continue |
default |
do |
double |
else |
enum |
extends |
final |
finally |
float |
for |
if |
implements |
import |
instanceof |
int |
interface |
long |
native |
new |
package |
private |
protected |
public |
return |
short |
static |
strictfp |
super |
switch |
synchronized |
this |
throw |
throws |
transient |
try |
void |
volatile |
while |
|
|
Keywords that are not currently used |
|
|
|
|
const |
goto |
|
|
|
Java also contains the reserved words true and false, which are boolean literals, and null, which is the literal that represents a reference to nothing. Like keywords, these reserved words cannot be used as identifiers.
[Page 1402]
Appendix D. Primitive Types
Figure D.1. Java primitive types.
Type |
Size in bits |
Values |
Standard |
|
|
|
|
boolean |
|
true or false |
|
[Note: A boolean's representation is specific to the Java Virtual Machine on each platform.] |
|||
char |
16 |
'\u0000' to '\uFFFF' (0 to 65535) |
(ISO Unicode |
|
|
|
character set) |
byte |
8 |
128 to +127 (27 to 27 1) |
|
short |
16 |
32,768 to +32,767 (215 to 215 1) |
|
int |
32 |
2,147,483,648 to +2,147,483,647 (231 to 231 1) |
|
long |
64 |
9,223,372,036,854,775,808 to |
|
|
|
+9,223,372,036,854,775,807 (263 to 263 1) |
|
float |
32 |
Negative range: |
(IEEE 754 |
|
|
3.4028234663852886E+38 to |
floating point) |
|
|
1.40129846432481707e45 |
|
|
|
Positive range: |
|
|
|
1.40129846432481707e45 to |
|
|
|
3.4028234663852886E+38 |
|
double |
64 |
Negative range: |
(IEEE 754 |
|
|
1.7976931348623157E+308 to |
floating point) |
|
|
4.94065645841246544e324 |
|
|
|
Positive range: |
|
4.94065645841246544e324 to
1.7976931348623157E+308
For more information on IEEE 754 visit grouper.ieee.org/groups/754/. For more information on Unicode, see Appendix F, Unicode®.
[Page 1403]
Appendix E. (On CD) Number Systems
Here are only numbers ratified.
William Shakespeare
Nature has some sort of arithmetic-geometrical coordinate system, because nature has all kinds of models. What we experience of nature is in models, and all of nature's models are so beautiful.
It struck me that nature's system must be a real beauty, because in chemistry we find that the associations are always in beautiful whole numbersthere are no fractions.
Richard Buckminster Fuller
Appendix E (pages 14031415) is located on the CD that accompanies this book in printable Adobe® Acrobat PDF format. You can download Adobe® Reader® from
www.adobe.com/products/acrobat/readstep2.html
In the index, page references for all the CD appendices appear in red. Defining occurrences of terms in the CD appendices appear in bold red.]
[Page 1416]
Appendix F. (On CD) Unicode®
Appendix F (pages 14161426) is located on the CD that accompanies this book in printable Adobe® Acrobat PDF format. You can download Adobe® Reader® from
www.adobe.com/products/acrobat/readstep2.html
In the index, page references for all the CD appendices appear in red. Defining occurrences of terms in the CD appendices appear in bold red.]
[Page 1427]
Appendix G. Using the Java API
Documentation
Section G.1. Introduction
Section G.2. Navigating the Java API
[Page 1427 (continued)]
G.1. Introduction
The Java class library contains thousands of predefined classes and interfaces that programmers can use to write their own applications. These classes are grouped into packages based on their functionality. For example, the classes and interfaces used for file processing are grouped into the java.io package, and the classes and interfaces for networking applications are grouped into the java.net package. The Java API documentation lists the public and protected members of each class and the public members of each interface in the Java class library. The documentation overviews all the classes and interfaces, summarizes their members (i.e., the fields, constructors and methods of classes, and the fields and methods of interfaces) and provides detailed descriptions of each member. Most Java programmers rely on this documentation when writing programs. Normally, programmers would search the API to find the following:
1.The package that contains a particular class or interface.
2.Relationships between a particular class or interface and other classes and interfaces.
3.Class or interface constantsnormally declared as public static final fields.
4.Constructors to determine how an object of the class can be initialized.
5.The methods of a class to determine whether they are static or non-static, the number and types of the arguments you need to pass, the return types and any exceptions that might be thrown from the method.
In addition, programmers often rely on the documentation to discover classes and interfaces that they have not used before. For this reason, we demonstrate the documentation with classes you know and classes you may not have studied yet. We show how to use the documentation to locate the information you need to use a class or interface effectively.
[Note: Sun Microsystems has renamed the Java 2 Platform, Standard Edition version 1.5.0 to Java 2 Platform, Standard Edition version 5.0. However, they decided not to replace the occurrences of 1.5.0 with 5.0 in the documentation. Although the URLs that represent the documentation on Sun's Java Web site work with 5.0 in the URL, these URLs are redirected to ones that replace the 5.0 with 1.5.0. For this reason, all URLs in this appendix are listed with 1.5.0 in the URL.]
[Page 1428]
