Specifications

Sun Services
Java™ Programming Language
vii
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
Variable Initialization ............................................................................................................................. 4-7
Initialization Before Use Principle ........................................................................................................ 4-8
Operator Precedence .............................................................................................................................. 4-9
Logical Operators .................................................................................................................................. 4-10
Bitwise Logical Operators .................................................................................................................... 4-11
Right-Shift Operators >> and >>> ....................................................................................................... 4-12
Left-Shift Operator << .......................................................................................................................... 4-13
Shift Operator Examples ...................................................................................................................... 4-14
String Concatenation With + ............................................................................................................... 4-15
Casting .................................................................................................................................................... 4-16
Promotion and Casting of Expressions .............................................................................................. 4-17
Simple if, else Statements .............................................................................................................. 4-18
Complex if, else Statements .......................................................................................................... 4-19
Switch Statements ................................................................................................................................. 4-21
Looping Statements .............................................................................................................................. 4-24
Special Loop Flow Control .................................................................................................................. 4-27
The break Statement ............................................................................................................................ 4-28
The continue Statement ..................................................................................................................... 4-29
Using break Statements with Labels ................................................................................................. 4-30
Using continue Statements with Labels .......................................................................................... 4-31
Arrays ........................................................................................................................ 5-1
Objectives ................................................................................................................................................. 5-2
Relevance .................................................................................................................................................. 5-3
Declaring Arrays ..................................................................................................................................... 5-4
Creating Arrays ....................................................................................................................................... 5-5
Creating Reference Arrays ..................................................................................................................... 5-7
Initializing Arrays ................................................................................................................................... 5-9
Multidimensional Arrays ..................................................................................................................... 5-10
Array Bounds ........................................................................................................................................ 5-12